コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }