示例#1
0
        public void ReturnRemainingFatsIntake_WhenInvokedWithValidParameters()
        {
            // Arrange
            var suggestedDailyFatsIntake = 70;

            var firstProduct  = new Mock <IProduct>();
            var secondProduct = new Mock <IProduct>();

            firstProduct
            .SetupGet(m => m.Fat)
            .Returns(12);

            secondProduct
            .SetupGet(m => m.Fat)
            .Returns(22);

            var expectedResult = 36; // 70 - 34
            ICollection <IProduct> productConsumed = new List <IProduct> {
                firstProduct.Object, secondProduct.Object
            };
            var dailyNutriCalcMock = new DailyNutriCalc();

            // Act
            var actualResult = dailyNutriCalcMock.RemainingFatsIntake(suggestedDailyFatsIntake, productConsumed);

            // Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
示例#2
0
        public void ReturnSuggestedFatsIntake_WhenProductsConsumedAreNull()
        {
            // Arrange
            var suggestedDailyFatsIntake = 220;
            var expectedResult           = suggestedDailyFatsIntake;

            var dailyNutriCalcMock = new DailyNutriCalc();

            // Act
            var actualResult = dailyNutriCalcMock.RemainingFatsIntake(suggestedDailyFatsIntake, null);

            // Assert
            Assert.AreEqual(expectedResult, actualResult);
        }