public async Task GetFlowShouldReturnBadRequestWhenResultIsFailure() { //Arrange var flowLocal = Result.Fail <FlowDataModel>("Bad request to EccSetup.API"); var mobileServiceMock = new Mock <IMobileService>(); mobileServiceMock.Setup(x => x.GetFlow(It.IsAny <FlowFilterFromBody>())).Returns(Task.FromResult(flowLocal)); var mobileService = mobileServiceMock.Object; //Act var controller = new SetupController(mobileService); var response = await controller.GetFlow(new FlowFilterFromBody()); //Asert var result = response as BadRequestResult; result.StatusCode.Should().Be((int)HttpStatusCode.BadRequest); }
public async Task GetFlowShouldReturnNoContentResultWhenNoFlowFound() { //Arrange FlowDataModel model = null; var flowLocal = Result.Ok(model); var mobileServiceMock = new Mock <IMobileService>(); mobileServiceMock.Setup(x => x.GetFlow(It.IsAny <FlowFilterFromBody>())).Returns(Task.FromResult(flowLocal)); var mobileService = mobileServiceMock.Object; //Act var controller = new SetupController(mobileService); var response = await controller.GetFlow(new FlowFilterFromBody()); //Assert var result = response as NoContentResult; result.StatusCode.Should().Be((int)HttpStatusCode.NoContent); }
public async Task GetFlowShouldReturnOKStatusCode() { var flowLocal = Result.Ok(new FlowDataModel() { Name = "Test" }); var mobileServiceMock = new Mock <IMobileService>(); mobileServiceMock.Setup(x => x.GetFlow(It.IsAny <FlowFilterFromBody>())).Returns(Task.FromResult(flowLocal)); var mobileService = mobileServiceMock.Object; //Act var controller = new SetupController(mobileService); var response = await controller.GetFlow(new FlowFilterFromBody()); //Assert var result = response as OkObjectResult; result.StatusCode.Should().Be((int)HttpStatusCode.OK); }