@@ -16,6 +16,7 @@ public class DependencyManagementTests
1616 private readonly string _dependencyManagementDirectory ;
1717 private readonly string _functionId ;
1818 private const string ManagedDependenciesFolderName = "ManagedDependencies" ;
19+ private const string AzureFunctionsFolderName = "AzureFunctions" ;
1920
2021 public DependencyManagementTests ( )
2122 {
@@ -42,6 +43,14 @@ private FunctionLoadRequest GetFuncLoadRequest(string functionAppRoot, bool mana
4243 return functionLoadRequest ;
4344 }
4445
46+ private string GetManagedDependenciesPath ( string functionAppRootPath )
47+ {
48+ string functionAppName = Path . GetFileName ( functionAppRootPath ) ;
49+ string appDataFolder = Environment . GetFolderPath ( Environment . SpecialFolder . LocalApplicationData , Environment . SpecialFolderOption . DoNotVerify ) ;
50+ string managedDependenciesFolderPath = Path . Combine ( appDataFolder , AzureFunctionsFolderName , functionAppName , ManagedDependenciesFolderName ) ;
51+ return managedDependenciesFolderPath ;
52+ }
53+
4554 private void TestCaseCleanup ( )
4655 {
4756 // We run a test case clean up to reset DependencyManager.Dependencies and DependencyManager.DependenciesPath
@@ -66,10 +75,10 @@ public void TestManagedDependencyBasicRequirements()
6675 {
6776 // Test case setup.
6877 var requirementsDirectoryName = "BasicRequirements" ;
69- var functionFolderPath = Path . Combine ( _dependencyManagementDirectory , requirementsDirectoryName ,
70- "FunctionDirectory" ) ;
71- var managedDependenciesFolderPath = Path . Combine ( _dependencyManagementDirectory ,
72- requirementsDirectoryName , ManagedDependenciesFolderName ) ;
78+ var functionFolderPath = Path . Combine ( _dependencyManagementDirectory , requirementsDirectoryName , "FunctionDirectory" ) ;
79+ var functionAppRoot = Path . Combine ( _dependencyManagementDirectory , requirementsDirectoryName ) ;
80+ var managedDependenciesFolderPath = GetManagedDependenciesPath ( functionAppRoot ) ;
81+
7382 var functionLoadRequest = GetFuncLoadRequest ( functionFolderPath , true ) ;
7483
7584 // Create DependencyManager and process the requirements.psd1 file at the function app root.
@@ -97,10 +106,9 @@ public void TestManagedDependencyEmptyHashtableRequirement()
97106 {
98107 // Test case setup.
99108 var requirementsDirectoryName = "EmptyHashtableRequirement" ;
100- var functionFolderPath = Path . Combine ( _dependencyManagementDirectory , requirementsDirectoryName ,
101- "FunctionDirectory" ) ;
102- var managedDependenciesFolderPath = Path . Combine ( _dependencyManagementDirectory ,
103- requirementsDirectoryName , ManagedDependenciesFolderName ) ;
109+ var functionFolderPath = Path . Combine ( _dependencyManagementDirectory , requirementsDirectoryName , "FunctionDirectory" ) ;
110+ var functionAppRoot = Path . Combine ( _dependencyManagementDirectory , requirementsDirectoryName ) ;
111+ var managedDependenciesFolderPath = GetManagedDependenciesPath ( functionAppRoot ) ;
104112 var functionLoadRequest = GetFuncLoadRequest ( functionFolderPath , true ) ;
105113
106114 // Create DependencyManager and process the requirements.psd1 file at the function app root.
0 commit comments