@@ -492,57 +492,23 @@ public async Task GetExtensionsStartupTypes_BundlesNotConfiguredBindingsConfigur
492492 [ Fact ]
493493 public async Task GetExtensionsStartupTypes_NoBindings_In_ExtensionJson ( )
494494 {
495- TestMetricsLogger testMetricsLogger = new TestMetricsLogger ( ) ;
496-
497- using var directory = new TempDirectory ( ) ;
498- var binPath = Path . Combine ( directory . Path , "bin" ) ;
499- Directory . CreateDirectory ( binPath ) ;
500-
501- void CopyToBin ( string path )
495+ ExtensionInstall storage1 = new ( "AzureStorageBlobs" , typeof ( AzureStorageWebJobsStartup ) ) ;
496+ ExtensionInstall storage2 = new ( "Storage" , typeof ( AzureStorageWebJobsStartup ) )
502497 {
503- File . Copy ( path , Path . Combine ( binPath , Path . GetFileName ( path ) ) ) ;
504- }
498+ HintPath = "Microsoft.Azure.WebJobs.Extensions.Storage.dll"
499+ } ;
505500
506- CopyToBin ( typeof ( AzureStorageWebJobsStartup ) . Assembly . Location ) ;
507-
508- string extensionJson = $$ """
509- {
510- "extensions": [
511- {
512- "name": "Storage",
513- "typeName": "{{ typeof ( AzureStorageWebJobsStartup ) . AssemblyQualifiedName }} ",
514- "hintPath": "Microsoft.Azure.WebJobs.Extensions.Storage.dll"
515- },
516- {
517- "Name": "AzureStorageBlobs",
518- "TypeName": "{{ typeof ( AzureStorageWebJobsStartup ) . AssemblyQualifiedName }} "
519- }
520- ]
521- }
522- """ ;
523-
524- File . WriteAllText ( Path . Combine ( binPath , "extensions.json" ) , extensionJson ) ;
525-
526- TestLoggerProvider testLoggerProvider = new TestLoggerProvider ( ) ;
527- LoggerFactory factory = new LoggerFactory ( ) ;
528- factory . AddProvider ( testLoggerProvider ) ;
529- var testLogger = factory . CreateLogger < ScriptStartupTypeLocator > ( ) ;
530-
531- var mockExtensionBundleManager = new Mock < IExtensionBundleManager > ( ) ;
532- mockExtensionBundleManager . Setup ( e => e . IsExtensionBundleConfigured ( ) ) . Returns ( true ) ;
533- mockExtensionBundleManager . Setup ( e => e . GetExtensionBundleDetails ( ) ) . Returns ( Task . FromResult ( new ExtensionBundleDetails ( ) { Id = "bundleID" , Version = "1.0.0" } ) ) ;
534- mockExtensionBundleManager . Setup ( e => e . GetExtensionBundleBinPathAsync ( ) ) . Returns ( Task . FromResult ( binPath ) ) ;
535-
536- var languageWorkerOptions = new TestOptionsMonitor < LanguageWorkerOptions > ( new LanguageWorkerOptions ( ) ) ;
537- var mockFunctionMetadataManager = GetTestFunctionMetadataManager ( languageWorkerOptions ) ;
538- OptionsWrapper < ExtensionRequirementOptions > optionsWrapper = new ( new ExtensionRequirementOptions ( ) ) ;
539- var discoverer = new ScriptStartupTypeLocator ( directory . Path , testLogger , mockExtensionBundleManager . Object , mockFunctionMetadataManager , testMetricsLogger , optionsWrapper ) ;
501+ string binPath = InstallExtensions ( storage1 , storage2 ) ;
502+ _bundleManager . Setup ( e => e . IsExtensionBundleConfigured ( ) ) . Returns ( true ) ;
503+ _bundleManager . Setup ( e => e . GetExtensionBundleDetails ( ) ) . ReturnsAsync ( new ExtensionBundleDetails ( ) { Id = "bundleID" , Version = "1.0.0" } ) ;
504+ _bundleManager . Setup ( e => e . GetExtensionBundleBinPathAsync ( ) ) . ReturnsAsync ( binPath ) ;
505+ ScriptStartupTypeLocator discoverer = CreateSystemUnderTest ( ) ;
540506
541507 // Act
542508 var types = await discoverer . GetExtensionsStartupTypesAsync ( ) ;
543509
544510 // Assert
545- AreExpectedMetricsGenerated ( testMetricsLogger ) ;
511+ AreExpectedMetricsGenerated ( ) ;
546512 Assert . Equal ( types . Count ( ) , 2 ) ;
547513 Assert . Equal ( typeof ( AzureStorageWebJobsStartup ) . FullName , types . FirstOrDefault ( ) . FullName ) ;
548514 }
@@ -703,6 +669,8 @@ private bool AreExpectedMetricsGenerated()
703669
704670 private class ExtensionInstall ( string name , Type startupType , params string [ ] bindings )
705671 {
672+ public string HintPath { get ; init ; }
673+
706674 public static ExtensionInstall Storage ( bool includeBinding = false )
707675 {
708676 string [ ] bindings = includeBinding ? [ "blob" ] : [ ] ;
@@ -727,7 +695,12 @@ public static ExtensionInstall Http()
727695
728696 public ExtensionReference GetReference ( )
729697 {
730- ExtensionReference reference = new ( ) { Name = name , TypeName = startupType . AssemblyQualifiedName } ;
698+ ExtensionReference reference = new ( )
699+ {
700+ Name = name ,
701+ TypeName = startupType . AssemblyQualifiedName ,
702+ HintPath = HintPath ,
703+ } ;
731704 foreach ( string binding in bindings ?? Enumerable . Empty < string > ( ) )
732705 {
733706 reference . Bindings . Add ( binding ) ;
0 commit comments