public async Task HandleRequest_GivenThatMediatorExecutetionSucceded_ReturnsOkResponse() { // Arrange var request = this.fixture.Create <TestRequest>(); this.mediator.Execute <TestRequest, OperationResult>(request) .Returns(OperationResultCreator.Success()); // Act var response = await this.sut.TestHandleResuest <TestRequest, OperationResult>(request); // Assert Assert.IsType <OkObjectResult>(response); }
public RequestPipelineTests() { this.interactor = Substitute.For <IInteractor <TestRequest, OperationResult> >(); this.interactor.Handle(Arg.Any <TestRequest>()).Returns(OperationResultCreator.Success()); this.logger = Substitute.For <ILogger <RequestPipeline <TestRequest, OperationResult> > >(); this.authorizer = Substitute.For <IAuthorizer <TestRequest> >(); this.authorizer.Authorize(Arg.Any <TestRequest>()).Returns(OperationResultCreator.Success()); this.validator = Substitute.For <IValidator <TestRequest> >(); this.validator.Validate(Arg.Any <TestRequest>()).Returns(OperationResultCreator.Success()); this.sut = new RequestPipeline <TestRequest, OperationResult>(this.interactor, this.logger, this.authorizer, this.validator); }