public async void Create_Errors() { ChannelControllerMockFacade mock = new ChannelControllerMockFacade(); var mockResponse = new Mock <CreateResponse <ApiChannelResponseModel> >(new FluentValidation.Results.ValidationResult()); var mockRecord = new ApiChannelResponseModel(); mockResponse.SetupGet(x => x.Success).Returns(false); mock.ServiceMock.Setup(x => x.Create(It.IsAny <ApiChannelRequestModel>())).Returns(Task.FromResult <CreateResponse <ApiChannelResponseModel> >(mockResponse.Object)); ChannelController controller = new ChannelController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = new DefaultHttpContext(); IActionResult response = await controller.Create(new ApiChannelRequestModel()); response.Should().BeOfType <ObjectResult>(); (response as ObjectResult).StatusCode.Should().Be((int)HttpStatusCode.UnprocessableEntity); mock.ServiceMock.Verify(x => x.Create(It.IsAny <ApiChannelRequestModel>())); }