public void ProcessRequestAsync_NullExecutionRequest_ShouldThrowException() { var mockExecAdapter = new Mock <IExecutionAdapter>(); var mockLogger = new Mock <ILogger <ExecutionProcessor <IExecutionAdapter> > >(); var execProcessor = new ExecutionProcessor <IExecutionAdapter>( mockExecAdapter.Object, mockLogger.Object, defaultProcessorOptions); Func <Task> act = async() => await execProcessor.ProcessRequestAsync(null, CancellationToken.None); act.Should().Throw <ArgumentNullException>(); }
public async Task ProcessRequestAsync_ValidExecutionRequest_ShouldInvokeExecutionAdapter() { var mockExecAdapter = new Mock <IExecutionAdapter>(); var mockLogger = new Mock <ILogger <ExecutionProcessor <IExecutionAdapter> > >(); var execProcessor = new ExecutionProcessor <IExecutionAdapter>( mockExecAdapter.Object, mockLogger.Object, defaultProcessorOptions); var execRequest = CreateDefaultExecutionRequest(); var execContext = execRequest.ToExecutionContext().UpdateStatus(ExecutionStatus.Succeeded); mockExecAdapter.Setup(ea => ea.ExecuteAsync(execRequest, It.IsAny <CancellationToken>())) .Returns(Task.FromResult(execContext)); await execProcessor.ProcessRequestAsync(execRequest, CancellationToken.None); mockExecAdapter.Verify(ea => ea.ExecuteAsync(execRequest, It.IsAny <CancellationToken>())); }