solidtoken / SpecFlow.DependencyInjection

SpecFlow plugin that enables to use Microsoft.Extensions.DependencyInjection for resolving test dependencies.
BSD 3-Clause "New" or "Revised" License
35 stars 11 forks source link

Automatically register SpecFlow bindings #25

Closed 304NotModified closed 4 years ago

304NotModified commented 4 years ago

Fixes #24, fixes #7

304NotModified commented 4 years ago

Please squash when accepted :)

mbhoek commented 4 years ago

You move fast! 😄 Let me check this tonight, I think there was a reason for using the return () => and Func<IServiceCollection> constructs having to do with timing so I just want to make sure.

Thanks for your contribution!

304NotModified commented 4 years ago

it's still doing return () => ;)

But please do check :)

Thanks for the great library!

304NotModified commented 4 years ago

@mbhoek I've updated the PR so it also resolves #7 :)

304NotModified commented 4 years ago

luckily I didn't do a force push, so you could check the latest commit :)

304NotModified commented 4 years ago

Looks ok, but I need to check what happens if users already added the piece of initialisation code

No crash at my side, but not sure if there goes some else wrong

304NotModified commented 4 years ago

To be clear, if you leave this:

            foreach (var type in typeof(TestDependencies).Assembly.GetTypes().Where(t => Attribute.IsDefined(t, typeof(BindingAttribute)))) 
            {   
                services.AddSingleton(type);    
            }

Then still all tests are green.