public async Task CreateNidDocsAsync_ReturnsBadRequest_WhenFailedToAddDocs() { //Arrange CreateMockedObjects(); mockDocService.Setup(s => s.CreateNidDocAsync(It.IsAny <NidDoc>(), It.IsAny <bool>())) .ReturnsAsync(GetFakeInvalidDocResponse()); var controller = new NidDocController(mockDocService.Object, mapper, logFactory); //Act var result = await controller.CreateNidDocAsync(GetFakeDocResourceIn()); //Assert var badRequestResult = Assert.IsType <BadRequestObjectResult>(result); Assert.Equal("Failed to create Nid doc!", badRequestResult.Value); }
public async Task CreateNidDocsAsync_ReturnsNidDocResourceOutList_WhenSucceededToAddNidDocs() { //Arrange CreateMockedObjects(); mockDocService.Setup(s => s.CreateNidDocAsync(It.IsAny <NidDoc>(), It.IsAny <bool>())) .ReturnsAsync(GetFakeValidDocsResponse()); var controller = new NidDocController(mockDocService.Object, mapper, logFactory); //Act var result = await controller.CreateNidDocAsync(GetFakeDocResourceIn()); //Assert var okRequestResult = Assert.IsType <OkObjectResult>(result); var succeededNidDocResponce = Assert.IsType <NidDocResourceOut>(okRequestResult.Value); Assert.Equal(1, succeededNidDocResponce.StateId); }
public async Task GetDocPriceAsync_ReturnsNidDocPrice() { //Arrange decimal defaultPrice = 100; CreateMockedObjects(); mockDocService.Setup(s => s.GetDocPrice()) .ReturnsAsync(defaultPrice); var controller = new NidDocController(mockDocService.Object, mapper, logFactory); //Act var result = await controller.GetDocPriceAsync(); //Assert var okRequestResult = Assert.IsType <OkObjectResult>(result); Assert.Equal(defaultPrice, okRequestResult.Value); }