public async Task CreateBirthDocsAsync_ReturnsBadRequest_WhenFailedToAddDocs() { //Arrange CreateMockedObjects(); mockDocService.Setup(s => s.CreateBirthDocsAsync(It.IsAny <IEnumerable <BirthDoc> >(), It.IsAny <bool>())) .ReturnsAsync(GetFakeInvalidDocsResponseList()); var controller = new BirthDocController(mockDocService.Object, mapper, logFactory); //Act var result = await controller.CreateBirthDocsAsync(GetFakeDocResourceInList()); //Assert var badRequestResult = Assert.IsType <BadRequestObjectResult>(result); Assert.Equal("Failed to create birth doc!", badRequestResult.Value); }
public async Task CreateBirthDocsAsync_ReturnsBirthDocResourceOutList_WhenSucceededToAddBirthDocs() { //Arrange CreateMockedObjects(); mockDocService.Setup(s => s.CreateBirthDocsAsync(It.IsAny <IEnumerable <BirthDoc> >(), It.IsAny <bool>())) .ReturnsAsync(GetFakeValidDocsResponseList()); var controller = new BirthDocController(mockDocService.Object, mapper, logFactory); //Act var result = await controller.CreateBirthDocsAsync(GetFakeDocResourceInList()); //Assert var okRequestResult = Assert.IsType <OkObjectResult>(result); var succeededBirthDocResponce = Assert.IsType <List <BirthDocResourceOut> >(okRequestResult.Value); Assert.Equal(1, succeededBirthDocResponce.First().StateId); }
public async Task GetDocPriceAsync_ReturnsBirthDocPrice() { //Arrange decimal defaultPrice = 100; CreateMockedObjects(); mockDocService.Setup(s => s.GetDocPrice()) .ReturnsAsync(defaultPrice); var controller = new BirthDocController(mockDocService.Object, mapper, logFactory); //Act var result = await controller.GetDocPriceAsync(); //Assert var okRequestResult = Assert.IsType <OkObjectResult>(result); Assert.Equal(defaultPrice, okRequestResult.Value); }