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 mockSandbox = new Mock <ISandbox>(); mockSandbox.Setup(sandbox => sandbox.GetAllPendingMessages()).Returns(_pendingMessages); var hooks = new HashSet <HookMethod> { new HookMethod(GetType().GetMethod("Foo"), typeof(Step).Assembly) }; var hooksToExecute = hooks.Select(method => method.Method); mockHookRegistry.Setup(x => x.AfterStepHooks).Returns(hooks); var stepExecutionEndingRequest = StepExecutionEndingRequest.DefaultInstance; _request = Message.CreateBuilder() .SetMessageId(20) .SetMessageType(Message.Types.MessageType.StepExecutionEnding) .SetStepExecutionEndingRequest(stepExecutionEndingRequest) .Build(); _mockMethodExecutor = new Mock <IMethodExecutor>(); _protoExecutionResultBuilder = ProtoExecutionResult.CreateBuilder() .SetExecutionTime(0) .SetFailed(false) .AddRangeMessage(_pendingMessages); _mockMethodExecutor.Setup(x => x.ExecuteHooks(hooksToExecute, stepExecutionEndingRequest.CurrentExecutionInfo)) .Returns(_protoExecutionResultBuilder); _stepExecutionEndingProcessor = new StepExecutionEndingProcessor(mockHookRegistry.Object, _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 mockMessageCollectorType = new Mock <Type>(); var mockScreenshtCollectorType = new Mock <Type>(); mockAssemblyLoader.Setup(x => x.GetLibType(LibType.MessageCollector)) .Returns(mockMessageCollectorType.Object); mockAssemblyLoader.Setup(x => x.GetLibType(LibType.ScreenshotCollector)) .Returns(mockScreenshtCollectorType.Object); 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.AfterStepHooks).Returns(hooks); var stepExecutionEndingRequest = new StepExecutionEndingRequest { CurrentExecutionInfo = new ExecutionInfo { CurrentSpec = new SpecInfo(), CurrentScenario = new ScenarioInfo() } }; _request = new Message { MessageType = Message.Types.MessageType.StepExecutionEnding, MessageId = 20, StepExecutionEndingRequest = stepExecutionEndingRequest }; _mockMethodExecutor = new Mock <IExecutionOrchestrator>(); _protoExecutionResult = new ProtoExecutionResult { ExecutionTime = 0, Failed = false }; _mockMethodExecutor.Setup(x => x.ExecuteHooks("AfterStep", It.IsAny <HooksStrategy>(), It.IsAny <IList <string> >(), It.IsAny <ExecutionContext>())) .Returns(_protoExecutionResult); _mockMethodExecutor.Setup(x => x.GetAllPendingMessages()).Returns(_pendingMessages); _mockMethodExecutor.Setup(x => x.GetAllPendingScreenshots()).Returns(_pendingScreenshots); _stepExecutionEndingProcessor = new StepExecutionEndingProcessor(_mockMethodExecutor.Object); }
public void Setup() { var mockHookRegistry = new Mock <IHookRegistry>(); var mockSandbox = new Mock <ISandbox>(); var mockAssemblyLoader = new Mock <IAssemblyLoader>(); var mockMessageCollectorType = new Mock <Type>(); mockAssemblyLoader.Setup(x => x.GetLibType(LibType.MessageCollector)) .Returns(mockMessageCollectorType.Object); 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.AfterStepHooks).Returns(hooks); var stepExecutionEndingRequest = new StepExecutionEndingRequest { CurrentExecutionInfo = new ExecutionInfo { CurrentSpec = new SpecInfo(), CurrentScenario = new ScenarioInfo() } }; _request = new Message { MessageType = Message.Types.MessageType.StepExecutionEnding, MessageId = 20, StepExecutionEndingRequest = stepExecutionEndingRequest }; _mockMethodExecutor = new Mock <IMethodExecutor>(); _protoExecutionResult = new ProtoExecutionResult { ExecutionTime = 0, Failed = false, Message = {} }; _mockMethodExecutor.Setup(x => x.ExecuteHooks("AfterStep", It.IsAny <TaggedHooksFirstStrategy>(), new List <string>())) .Returns(_protoExecutionResult); var mockReflectionWrapper = new Mock <IReflectionWrapper>(); mockReflectionWrapper.Setup(x => x.InvokeMethod(mockMessageCollectorType.Object, null, "GetAllPendingMessages", BindingFlags.Static | BindingFlags.Public)) .Returns(_pendingMessages); _stepExecutionEndingProcessor = new StepExecutionEndingProcessor(_mockMethodExecutor.Object, mockAssemblyLoader.Object, mockReflectionWrapper.Object); }
public void Setup() { var mockHookRegistry = new Mock <IHookRegistry>(); var mockSandbox = new Mock <ISandbox>(); mockSandbox.Setup(sandbox => sandbox.GetAllPendingMessages()).Returns(_pendingMessages); var hooks = new HashSet <IHookMethod> { new HookMethod("BeforeSpec", GetType().GetMethod("Foo"), typeof(Step).Assembly) }; mockHookRegistry.Setup(x => x.AfterStepHooks).Returns(hooks); var stepExecutionEndingRequest = new StepExecutionEndingRequest { CurrentExecutionInfo = new ExecutionInfo { CurrentSpec = new SpecInfo(), CurrentScenario = new ScenarioInfo() } }; _request = new Message { MessageType = Message.Types.MessageType.StepExecutionEnding, MessageId = 20, StepExecutionEndingRequest = stepExecutionEndingRequest }; _mockMethodExecutor = new Mock <IMethodExecutor>(); _protoExecutionResult = new ProtoExecutionResult { ExecutionTime = 0, Failed = false, Message = { _pendingMessages } }; _mockMethodExecutor.Setup(x => x.ExecuteHooks("AfterStep", It.IsAny <TaggedHooksFirstStrategy>(), new List <string>(), It.IsAny <ExecutionContext>())) .Returns(_protoExecutionResult); _stepExecutionEndingProcessor = new StepExecutionEndingProcessor(_mockMethodExecutor.Object); }