private object GetExtraParameter(ParameterInfo p, ScenarioContext scenarioContainer, IDependencyInjectionAdapter diAdapter) { object res = null; var name = p.GetCustomAttribute <KeyAttribute>()?.Key ?? p.ParameterType.FullName; if (scenarioContainer.TryGetValue(name, out res)) { return(res); } else { try { return(scenarioContainer.ScenarioContainer.Resolve(p.ParameterType)); } catch (Exception) { return(diAdapter.Resolve(p.ParameterType)); } } }
/// <summary> /// Initializes a new instance of the <see cref="Bootstrapper" /> class. /// </summary> /// <param name="adapter">The adapter.</param> public Bootstrapper(IDependencyInjectionAdapter adapter) { this.DependencyInjectionAdapter = adapter; }