FYI: I am using SpecFlow.Autofac nuget package.
Following GetContainer method exists within a parent class library project.
[ScenarioDependencies]
public static ContainerBuilder GetContainerWithDependencies()
{
var containerBuilder = new ContainerBuilder();
containerBuilder.RegisterType<PosMgmtScenarioCtx>().As<IScenarioContext>().InstancePerLifetimeScope();
return containerBuilder;
}
At a later point, within a child project (which references the parent), I attempt replacing the interface implementation with a new class but it does not work.
[Given(@"...Step...")]
public void GivenGenerateEmpWithXRefCode(some params)
{
using
(
var scope = _lifetimeScope.BeginLifetimeScope(
builder => {
// THIS DOES NOT WORK.
builder.RegisterType<EmployeeScenarioCtx>().As<IScenarioContext>();
}
)
)
{
_createUpdatePositionStepsLogic.PostPatchTheObject(service, "POST", "Employee", url, expectedStatusCode,
version);
}
}
Need to replace IScenarioContext with EmployeeScenarioCtx instead of PosMgmtScenarioCtx.
Any help would be appreciated, thanks!