Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }