private void InitializeExecutionMessageHandlers() { var tableFormatter = new TableFormatter(this._assemblyLoader, this._activatorWrapper); var classInstanceManager = new ThreadLocal <object>(() => { return(this._assemblyLoader.GetClassInstanceManager()); }); var executionInfoMapper = new ExecutionInfoMapper(this._assemblyLoader, this._activatorWrapper); var executionOrchestrator = new ExecutionOrchestrator(this._reflectionWrapper, this._assemblyLoader, classInstanceManager.Value, new HookExecutor(this._assemblyLoader, this._reflectionWrapper, classInstanceManager.Value, executionInfoMapper), new StepExecutor(this._assemblyLoader, this._reflectionWrapper, classInstanceManager.Value)); this.executionStartingProcessor = new ExecutionStartingProcessor(executionOrchestrator); this.executionEndingProcessor = new ExecutionEndingProcessor(executionOrchestrator); this.specExecutionStartingProcessor = new SpecExecutionStartingProcessor(executionOrchestrator); this.specExecutionEndingProcessor = new SpecExecutionEndingProcessor(executionOrchestrator); this.scenarioExecutionStartingProcessor = new ScenarioExecutionStartingProcessor(executionOrchestrator); this.scenarioExecutionEndingProcessor = new ScenarioExecutionEndingProcessor(executionOrchestrator); this.stepExecutionStartingProcessor = new StepExecutionStartingProcessor(executionOrchestrator); this.stepExecutionEndingProcessor = new StepExecutionEndingProcessor(executionOrchestrator); this.executeStepProcessor = new ExecuteStepProcessor(_stepRegistry, executionOrchestrator, tableFormatter); this.scenarioDataStoreInitProcessor = new ScenarioDataStoreInitProcessor(this._assemblyLoader); this.specDataStoreInitProcessor = new SpecDataStoreInitProcessor(this._assemblyLoader); this.suiteDataStoreInitProcessor = new SuiteDataStoreInitProcessor(this._assemblyLoader); }
public void Setup() { var mockHookRegistry = new Mock <IHookRegistry>(); var mockAssemblyLoader = new Mock <IAssemblyLoader>(); var mockMethod = new MockMethodBuilder(mockAssemblyLoader) .WithName("Foo") .WithFilteredHook(LibType.BeforeSpec) .Build(); var hooks = new HashSet <IHookMethod> { new HookMethod(LibType.BeforeSpec, mockMethod, mockAssemblyLoader.Object) }; mockHookRegistry.Setup(x => x.BeforeSuiteHooks).Returns(hooks); _mockMethodExecutor = new Mock <IExecutionOrchestrator>(); _protoExecutionResult = new ProtoExecutionResult { ExecutionTime = 0, Failed = false }; _mockMethodExecutor.Setup(x => x.ExecuteHooks("BeforeSuite", It.IsAny <HooksStrategy>(), It.IsAny <IList <string> >(), It.IsAny <ExecutionContext>())) .Returns(_protoExecutionResult); _mockMethodExecutor.Setup(x => x.GetAllPendingMessages()).Returns(_pendingMessages); _mockMethodExecutor.Setup(x => x.GetAllPendingScreenshotFiles()).Returns(_pendingScreenshotFiles); _executionStartingProcessor = new ExecutionStartingProcessor(_mockMethodExecutor.Object); }
public void Setup() { var mockHookRegistry = new Mock <IHookRegistry>(); var hooks = new HashSet <IHookMethod> { new HookMethod("BeforeSpec", GetType().GetMethod("Foo"), typeof(Step).Assembly) }; mockHookRegistry.Setup(x => x.BeforeSuiteHooks).Returns(hooks); var executionEndingRequest = new ExecutionStartingRequest(); _request = new Message { MessageId = 20, MessageType = Message.Types.MessageType.ExecutionEnding, ExecutionStartingRequest = executionEndingRequest }; _mockMethodExecutor = new Mock <IMethodExecutor>(); _protoExecutionResult = new ProtoExecutionResult { ExecutionTime = 0, Failed = false }; _mockMethodExecutor.Setup(x => x.ExecuteHooks("BeforeSuite", It.IsAny <HooksStrategy>(), new List <string>(), It.IsAny <ExecutionContext>())) .Returns(_protoExecutionResult); _executionStartingProcessor = new ExecutionStartingProcessor(_mockMethodExecutor.Object); }
private void InitializeExecutionMessageHandlers() { var activatorWrapper = new ActivatorWrapper(); var reflectionWrapper = new ReflectionWrapper(); var assemblies = new AssemblyLocater(new DirectoryWrapper(), new FileWrapper()).GetAllAssemblies(); var assemblyLoader = new AssemblyLoader(new AssemblyWrapper(), assemblies, reflectionWrapper, activatorWrapper); _stepRegistry = assemblyLoader.GetStepRegistry(); var tableFormatter = new TableFormatter(assemblyLoader, activatorWrapper); var classInstanceManager = assemblyLoader.GetClassInstanceManager(); var executionOrchestrator = new ExecutionOrchestrator(reflectionWrapper, assemblyLoader, activatorWrapper, classInstanceManager, new HookExecutor(assemblyLoader, reflectionWrapper, classInstanceManager), new StepExecutor(assemblyLoader, reflectionWrapper, classInstanceManager)); this.executionStartingProcessor = new ExecutionStartingProcessor(executionOrchestrator); this.executionEndingProcessor = new ExecutionEndingProcessor(executionOrchestrator); this.specExecutionStartingProcessor = new SpecExecutionStartingProcessor(executionOrchestrator); this.specExecutionEndingProcessor = new SpecExecutionEndingProcessor(executionOrchestrator); this.scenarioExecutionStartingProcessor = new ScenarioExecutionStartingProcessor(executionOrchestrator); this.scenarioExecutionEndingProcessor = new ScenarioExecutionEndingProcessor(executionOrchestrator); this.stepExecutionStartingProcessor = new StepExecutionStartingProcessor(executionOrchestrator); this.stepExecutionEndingProcessor = new StepExecutionEndingProcessor(executionOrchestrator); this.executeStepProcessor = new ExecuteStepProcessor(_stepRegistry, executionOrchestrator, tableFormatter); this.scenarioDataStoreInitProcessor = new ScenarioDataStoreInitProcessor(assemblyLoader); this.specDataStoreInitProcessor = new SpecDataStoreInitProcessor(assemblyLoader); this.suiteDataStoreInitProcessor = new SuiteDataStoreInitProcessor(assemblyLoader); }
public void Setup() { var mockHookRegistry = new Mock <IHookRegistry>(); var mockAssemblyLoader = new Mock <IAssemblyLoader>(); var mockType = new Mock <Type>().Object; mockAssemblyLoader.Setup(x => x.GetLibType(LibType.MessageCollector)).Returns(mockType); mockAssemblyLoader.Setup(x => x.GetLibType(LibType.ScreenshotCollector)).Returns(mockType); var mockMethod = new MockMethodBuilder(mockAssemblyLoader) .WithName("Foo") .WithFilteredHook(LibType.BeforeSpec) .Build(); var hooks = new HashSet <IHookMethod> { new HookMethod(LibType.BeforeSpec, mockMethod, mockAssemblyLoader.Object) }; mockHookRegistry.Setup(x => x.BeforeSuiteHooks).Returns(hooks); var executionEndingRequest = new ExecutionStartingRequest(); _request = new Message { MessageId = 20, MessageType = Message.Types.MessageType.ExecutionEnding, ExecutionStartingRequest = executionEndingRequest }; _mockMethodExecutor = new Mock <IExecutionOrchestrator>(); _protoExecutionResult = new ProtoExecutionResult { ExecutionTime = 0, Failed = false }; _mockMethodExecutor.Setup(x => x.ExecuteHooks("BeforeSuite", It.IsAny <HooksStrategy>(), new List <string>(), It.IsAny <ExecutionContext>())) .Returns(_protoExecutionResult); var mockReflectionWrapper = new Mock <IReflectionWrapper>(); mockReflectionWrapper.Setup(x => x.InvokeMethod(mockType, null, "GetAllPendingMessages", It.IsAny <BindingFlags>())) .Returns(_pendingMessages); mockReflectionWrapper.Setup(x => x.InvokeMethod(mockType, null, "GetAllPendingScreenshots", It.IsAny <BindingFlags>())) .Returns(_pendingScrennshots); _executionStartingProcessor = new ExecutionStartingProcessor(_mockMethodExecutor.Object, mockAssemblyLoader.Object, mockReflectionWrapper.Object); }
public void Setup() { var mockHookRegistry = new Mock <IHookRegistry>(); var mockAssemblyLoader = new Mock <IAssemblyLoader>(); var mockMethod = new MockMethodBuilder(mockAssemblyLoader) .WithName("Foo") .WithFilteredHook(LibType.BeforeSpec) .Build(); var hooks = new HashSet <IHookMethod> { new HookMethod(LibType.BeforeSpec, mockMethod, mockAssemblyLoader.Object) }; mockHookRegistry.Setup(x => x.BeforeSuiteHooks).Returns(hooks); var executionEndingRequest = new ExecutionStartingRequest(); _request = new Message { MessageId = 20, MessageType = Message.Types.MessageType.ExecutionEnding, ExecutionStartingRequest = executionEndingRequest }; _mockMethodExecutor = new Mock <IMethodExecutor>(); _protoExecutionResult = new ProtoExecutionResult { ExecutionTime = 0, Failed = false }; _mockMethodExecutor.Setup(x => x.ExecuteHooks("BeforeSuite", It.IsAny <HooksStrategy>(), new List <string>())) .Returns(_protoExecutionResult); var mockReflectionWrapper = new Mock <IReflectionWrapper>(); _executionStartingProcessor = new ExecutionStartingProcessor(_mockMethodExecutor.Object, mockAssemblyLoader.Object, mockReflectionWrapper.Object); }
public void Setup() { var mockHookRegistry = new Mock <IHookRegistry>(); var hooks = new HashSet <HookMethod> { new HookMethod(GetType().GetMethod("Foo"), typeof(Step).Assembly) }; var hooksToExecute = hooks.Select(method => method.Method); mockHookRegistry.Setup(x => x.BeforeSuiteHooks).Returns(hooks); var executionEndingRequest = ExecutionEndingRequest.DefaultInstance; _request = Message.CreateBuilder() .SetMessageId(20) .SetMessageType(Message.Types.MessageType.ExecutionEnding) .SetExecutionEndingRequest(executionEndingRequest) .Build(); _mockMethodExecutor = new Mock <IMethodExecutor>(); _protoExecutionResultBuilder = ProtoExecutionResult.CreateBuilder().SetExecutionTime(0).SetFailed(false); _mockMethodExecutor.Setup(x => x.ExecuteHooks(hooksToExecute, executionEndingRequest.CurrentExecutionInfo)) .Returns(_protoExecutionResultBuilder); _executionStartingProcessor = new ExecutionStartingProcessor(mockHookRegistry.Object, _mockMethodExecutor.Object); }