public IRunner this[TestScenario scenario] { get { if (scenario == null) return null; foreach (var type in _types) { IRunner runner = _container.Resolve(type) as IRunner; if (runner != null) { object[] attributes = type.GetCustomAttributes(typeof(ScenarioTypesAttribute), true); foreach (var attribute in attributes) { ScenarioTypesAttribute sta = attribute as ScenarioTypesAttribute; if (sta.Type == scenario.GetType()) return runner; } } } throw new Exception("No runner found that can handle this scenario. Make sure you have the ScenarioTypes attribute for your runner class."); } }
public void Initialize(TestScenario scenario) { lock (this) { if (this.IsRunning == false) { this.IsRunning = true; _result = new TestResultModel(); _result.Scenario = scenario; _scenario = scenario as WebTestScenario; scenario.PauseStateManager(); scenario.SetDirty(false); var wtrvm = _container.Resolve<WebTestCurrentResultViewModel>(); wtrvm.SetModel(_result); var view = _container.Resolve<WebTestResultView>(); view.DataContext = _result; wtrvm.SetView(view); _workspace.Documents.Add(wtrvm); _workspace.ActiveDocument = wtrvm; Task.Factory.StartNew(() => { this.BackRun(); this.WorkComplete(); }); } } }