Exemplo n.º 1
0
        public async Task GetByIdAsyncWhenInvalidIdReturnsDietNotFoundResponse()
        {
            // Arrange
            var mockDietRepository = GetDefaultIDietRepositoryInstance();
            var dietId             = 1;

            mockDietRepository.Setup(r => r.FindById(dietId))
            .Returns(Task.FromResult <Diet>(null));
            var mockUnitOfWork = GetDefaultIUnitOfWorkInstance();
            var service        = new DietService(mockDietRepository.Object, mockUnitOfWork.Object);
            // Act
            DietResponse result = await service.GetByIdAsync(dietId);

            var message = result.Message;

            // Assert
            message.Should().Be("Diet not found");
        }