Skip to content

Commit

Permalink
SpecFlowOSS#2307 Fixed bug when feature context can't be resolved at …
Browse files Browse the repository at this point in the history
…static methods (SpecFlowOSS#2315)
  • Loading branch information
HotTaton authored and Code-Grump committed Mar 29, 2023
1 parent 03f5927 commit 342d51a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ public class AutofacTestObjectResolver : ITestObjectResolver
{
public object ResolveBindingInstance(Type bindingType, IObjectContainer scenarioContainer)
{
var componentContext = scenarioContainer.Resolve<IComponentContext>();
return componentContext.Resolve(bindingType);
if (scenarioContainer.IsRegistered<IComponentContext>())
{
var componentContext = scenarioContainer.Resolve<IComponentContext>();
return componentContext.Resolve(bindingType);
}
return scenarioContainer.Resolve(bindingType);
}
}
}
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Fixes:
+ Cleanup scenario context even after an AfterScenario hook error
+ Load RuntimePlugins to the same AssemblyLoadContext
+ Capture hook errors and call plugin hooks after hook error
+ Fixed context injection in static methods for Autofac plugin https://github.com/SpecFlowOSS/SpecFlow/issues/2307

Changes:
+ Ignore tag handling: generate test framework specific ignore attributes
Expand Down

0 comments on commit 342d51a

Please sign in to comment.