Example #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);
        }
Example #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);
        }