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."); } }