public void Execute <TSut>(IScenario <TSut> testObject, string scenarioTitle = null) where TSut : class { using (var container = Configuration.ApplicationContainer.Get <IContainer>()) { var scenario = (IScenario <TSut>)container.Get(testObject.GetType()); scenario.SetContainer(container); foreach (var action in Configuration.PerScenarioActions) { if (action.ShouldExecute(scenario.GetType())) { action.Before(scenario); } } _testEngine.Execute(scenario); foreach (var action in Configuration.PerScenarioActions.AsEnumerable().Reverse()) { if (action.ShouldExecute(scenario.GetType())) { action.After(); } } } }
public void Execute(IScenario testObject, string scenarioTitle = null) { using (var container = Configuration.ApplicationContainer.Resolve <IContainer>()) { foreach (var action in Configuration.PerScenarioActions) { action.Before(container); } var scenario = (IScenario)container.Resolve(testObject.GetType()); scenario.SetContainer(container); _testEngine.Execute(scenario); foreach (var action in Configuration.PerScenarioActions.AsEnumerable().Reverse()) { action.After(); } } }
public void Execute(IScenario testObject, string scenarioTitle = null) { foreach (var action in _configuration.PerTestActions) { action.Before(); } using (var scenarioScope = _dependencyResolver.CreateChildContainer()) { var scenario = (IScenario)scenarioScope.Resolve(testObject.GetType()); var container = scenarioScope.Resolve <IContainer>(); scenario.SetContainer(container); _testEngine.Execute(scenario); } foreach (var action in _configuration.PerTestActions.AsEnumerable().Reverse()) { action.After(); } }