Ejemplo n.º 1
0
        public async void UpdatebyBusiness_CallsUpdatebyBusinessOnMockRepo_ReturnsCreatedObjectResult()
        {
            //Arrange
            long businessId  = 1;
            var  newBusiness = new Business()
            {
            };

            mockRepo.Setup(repo => repo.UpdatebyBusiness(newBusiness)).Returns(Task.FromResult <Business>(newBusiness));

            //Act
            var result = await controller.UpdatebyBusiness(businessId, newBusiness);

            var resultObj = result as OkObjectResult;

            //Asset
            mockRepo.Verify(repo => repo.UpdatebyBusiness(newBusiness), Times.Once);

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