示例#1
0
        public async Task Then_PostRequestIsSent(CreateApprenticeFeedbackTargetCommand command,
                                                 string errorContent)
        {
            var response = new ApiResponse <CreateApprenticeFeedbackTargetResponse>(null, HttpStatusCode.Created, errorContent);

            _mockApiClient.Setup(c => c.PostWithResponseCode <CreateApprenticeFeedbackTargetResponse>(It.IsAny <CreateApprenticeFeedbackTargetRequest>()))
            .ReturnsAsync(response);

            await _handler.Handle(command, CancellationToken.None);

            _mockApiClient.Verify(c => c.PostWithResponseCode <object>(It.IsAny <IPostApiRequest>()));
        }
示例#2
0
        public void And_ApiDoesNotReturnSuccess_Then_ThrowApiResponseException(
            HttpStatusCode statusCode,
            CreateApprenticeFeedbackTargetCommand command,
            string errorContent)
        {
            var response = new ApiResponse <object>(null, statusCode, errorContent);

            _mockApiClient.Setup(c => c.PostWithResponseCode <object>(It.IsAny <CreateApprenticeFeedbackTargetRequest>()))
            .ReturnsAsync(response);

            Func <Task> act = async() => await _handler.Handle(command, CancellationToken.None);

            act.Should().ThrowAsync <ApiResponseException>();
        }
        public async Task And_CommandIsProcessedSuccessfully_Then_ReturnCreated(CreateApprenticeFeedbackTargetCommand request)
        {
            var result = await _controller.CreateFeedbackTarget(request);

            result.Should().NotBeNull();
        }
示例#4
0
 public async Task <ActionResult <CreateApprenticeFeedbackTargetResponse> > CreateFeedbackTarget(CreateApprenticeFeedbackTargetCommand request)
 => await _mediator.Send(request);