Ejemplo n.º 1
0
        public async void InsertbyBusiness_CallsInsertbyBusinessOnMockRepo_ReturnsCreatedObjectResult()
        {
            //Arrange
            var expectedBusiness = new Business()
            {
            };

            mockRepo.Setup(repo => repo.InsertbyBusiness(expectedBusiness)).Returns(Task.FromResult <Business>(new Business {
            }));

            //Act
            var result = await controller.InsertbyBusiness(expectedBusiness);

            var resultObj = result as CreatedResult;

            //Asset
            mockRepo.Verify(repo => repo.InsertbyBusiness(expectedBusiness), Times.Once);

            Assert.NotNull(resultObj);
            Assert.Equal(201, resultObj.StatusCode);
        }