This repository was archived by the owner on May 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
SpecFlow.DependencyInjection Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 11using System ;
2+ using System . Collections . Generic ;
23using System . Linq ;
34using System . Reflection ;
45using Microsoft . Extensions . DependencyInjection ;
@@ -46,7 +47,7 @@ protected virtual Func<IServiceCollection> FindCreateScenarioServiceCollection()
4647 var serviceCollection = GetServiceCollection ( methodInfo ) ;
4748 if ( scenarioDependenciesAttribute . AutoRegisterBindings )
4849 {
49- AddBindingAttributes ( assembly , serviceCollection ) ;
50+ AddBindingAttributes ( assemblies , serviceCollection ) ;
5051 }
5152 return serviceCollection ;
5253 } ;
@@ -62,11 +63,14 @@ private static IServiceCollection GetServiceCollection(MethodBase methodInfo)
6263 return ( IServiceCollection ) methodInfo . Invoke ( null , null ) ;
6364 }
6465
65- private static void AddBindingAttributes ( Assembly assembly , IServiceCollection serviceCollection )
66+ private static void AddBindingAttributes ( IEnumerable < Assembly > bindingAssemblies , IServiceCollection serviceCollection )
6667 {
67- foreach ( var type in assembly . GetTypes ( ) . Where ( t => Attribute . IsDefined ( t , typeof ( BindingAttribute ) ) ) )
68+ foreach ( var assembly in bindingAssemblies )
6869 {
69- serviceCollection . AddSingleton ( type ) ;
70+ foreach ( var type in assembly . GetTypes ( ) . Where ( t => Attribute . IsDefined ( t , typeof ( BindingAttribute ) ) ) )
71+ {
72+ serviceCollection . AddSingleton ( type ) ;
73+ }
7074 }
7175 }
7276 }
You can’t perform that action at this time.
0 commit comments