SolidToken.SpecFlow.DependencyInjection.Tests.ContextInjectionScopeFeature.AssertContextIsScopedToScenarioExecution
System.InvalidOperationException: Unable to resolve service for type 'TechTalk.SpecFlow.UnitTestProvider.IUnitTestRuntimeProvider' while attempting to...
System.InvalidOperationException
Unable to resolve service for type 'TechTalk.SpecFlow.UnitTestProvider.IUnitTestRuntimeProvider' while attempting to activate 'SolidToken.SpecFlow.DependencyInjection.Tests.ContextInjectionScopeSteps'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites (System.Type serviceType, System.Type implementationType, Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteChain callSiteChain, System.Reflection.ParameterInfo[] parameters, System.Boolean throwIfCallSiteNotFound) [0x00048] in <2b9439bb001b4b6dbb9ed803b6ffd532>:0
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite (Microsoft.Extensions.DependencyInjection.ServiceLookup.ResultCache lifetime, System.Type serviceType, System.Type implementationType, Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteChain callSiteChain) [0x00079] in <2b9439bb001b4b6dbb9ed803b6ffd532>:0
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact (Microsoft.Extensions.DependencyInjection.ServiceDescriptor descriptor, System.Type serviceType, Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteChain callSiteChain, System.Int32 slot) [0x00073] in <2b9439bb001b4b6dbb9ed803b6ffd532>:0
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact (System.Type serviceType, Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteChain callSiteChain) [0x00018] in <2b9439bb001b4b6dbb9ed803b6ffd532>:0
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite (System.Type serviceType, Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteChain callSiteChain) [0x0002e] in <2b9439bb001b4b6dbb9ed803b6ffd532>:0
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory+<>c__DisplayClass7_0.<GetCallSite>b__0 (System.Type type) [0x00000] in <2b9439bb001b4b6dbb9ed803b6ffd532>:0
at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].GetOrAdd (TKey key, System.Func`2[T,TResult] valueFactory) [0x00034] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs:1002
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite (System.Type serviceType, Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteChain callSiteChain) [0x00014] in <2b9439bb001b4b6dbb9ed803b6ffd532>:0
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.CreateServiceAccessor (System.Type serviceType) [0x0000c] in <2b9439bb001b4b6dbb9ed803b6ffd532>:0
at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].GetOrAdd (TKey key, System.Func`2[T,TResult] valueFactory) [0x00034] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs:1002
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService (System.Type serviceType, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope serviceProviderEngineScope) [0x00013] in <2b9439bb001b4b6dbb9ed803b6ffd532>:0
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService (System.Type serviceType) [0x00008] in <2b9439bb001b4b6dbb9ed803b6ffd532>:0
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService (System.Type serviceType) [0x00000] in <2b9439bb001b4b6dbb9ed803b6ffd532>:0
at SolidToken.SpecFlow.DependencyInjection.DependencyInjectionTestObjectResolver.ResolveBindingInstance (System.Type bindingType, BoDi.IObjectContainer scenarioContainer) [0x00008] in /Users/ipcholko/Documents/__RND/SpecFlow.DependencyInjection/SpecFlow.DependencyInjection/DependencyInjectionTestObjectResolver.cs:12
at TechTalk.SpecFlow.ScenarioContext.GetBindingInstance (System.Type bindingType) [0x0000d] in <9c7e9a29b47547ca84af875086ce214a>:0
at (wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure,TechTalk.SpecFlow.Infrastructure.IContextManager,int)
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395
at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding (TechTalk.SpecFlow.Bindings.IBinding binding, TechTalk.SpecFlow.Infrastructure.IContextManager contextManager, System.Object[] arguments, TechTalk.SpecFlow.Tracing.ITestTracer testTracer, System.TimeSpan& duration) [0x0010c] in <9c7e9a29b47547ca84af875086ce214a>:0
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch (TechTalk.SpecFlow.Bindings.BindingMatch match, System.Object[] arguments, System.TimeSpan& duration) [0x00029] in <9c7e9a29b47547ca84af875086ce214a>:0
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep (TechTalk.SpecFlow.Infrastructure.IContextManager contextManager, TechTalk.SpecFlow.Bindings.StepInstance stepInstance) [0x0008b] in <9c7e9a29b47547ca84af875086ce214a>:0
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep () [0x0020f] in <9c7e9a29b47547ca84af875086ce214a>:0
at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors () [0x00000] in <9c7e9a29b47547ca84af875086ce214a>:0
at SolidToken.SpecFlow.DependencyInjection.Tests.ContextInjectionScopeFeature.ScenarioCleanup () [0x00001] in <af1b6c384b9c45c992845c3bee496821>:0
at SolidToken.SpecFlow.DependencyInjection.Tests.ContextInjectionScopeFeature.AssertContextIsScopedToScenarioExecution () [0x0016d] in /Users/ipcholko/Documents/__RND/SpecFlow.DependencyInjection/SpecFlow.DependencyInjection.Tests/ContextInjectionScope.feature:11
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395
Given I have test context with number 5
-> error: Unable to resolve service for type 'TechTalk.SpecFlow.UnitTestProvider.IUnitTestRuntimeProvider' while attempting to activate 'SolidToken.SpecFlow.DependencyInjection.Tests.ContextInjectionScopeSteps'. (0.1s)
When I multiply the test context number by 2
-> skipped because of previous errors
And I increase the test context number by 3
-> skipped because of previous errors
Then the test context number should be 13
-> skipped because of previous errors
When
SpecFlow.DependencyInjection
is used to configure dependencies it's no longer possible to injectIUnitTestRuntimeProvider
dependency.E.g.
This will produce an exception:
Is there are a way to configure this dependency?