private void RegisterInterceptors(IIocRegistrator reg, ITypeFinder typeFinder) { reg.RegisterInstance(new TestContextInterceptor()); FindTypesByMethodReturnValueAndRegisterInterceptor <IEnumerable <ExecutionResult>, TestContextInterceptor>( reg, typeFinder); reg.RegisterInstance(new TestContextStepInterceptor()); FindTypesByMethodReturnValueAndRegisterInterceptor <ExecutionResult, TestContextStepInterceptor>(reg, typeFinder); RegisterCommanders(reg, typeFinder); }
private void RegisterCommanders(IIocRegistrator reg, ITypeFinder typeFinder) { reg.RegisterInstance(new TestContextStepPartInterceptor()); var commanderTypes = typeFinder.FindClassesOfType <ICommander>(); if (!commanderTypes.Any()) { throw new AutomationException("Failed to find commander implementors. Please register commanders"); } foreach (var ct in commanderTypes) { var firstLevelCommanderInterfaces = GetFirstLevelInterfaces(ct) .Where(t => typeof(ICommander).IsAssignableFrom(t)); firstLevelCommanderInterfaces.ForEachItem(flci => reg.RegisterType(ct, flci, LifeCycle.PerDependency, interceptorTypes: new[] { typeof(TestContextStepPartInterceptor) })); } }