Example #1
0
        public void ReturnPositiveNumber_WhenParameterIsNotNull()
        {
            // Arrange
            var expectedResult = 11;

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

            firstProduct
            .SetupGet(m => m.Fiber)
            .Returns(5);

            secondProduct
            .SetupGet(m => m.Fiber)
            .Returns(6);

            ICollection <IProduct> productConsumed = new List <IProduct> {
                firstProduct.Object, secondProduct.Object
            };
            var dailyNutriCalcMock = new DailyNutriCalc();

            // Act
            var actualResult = dailyNutriCalcMock.CalculateCurrentFibers(productConsumed);

            // Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
Example #2
0
        public void Return0_WhenInvokedWithNullParameter()
        {
            // Arrange
            var expectedResult = 0;

            var dailyNutriCalcMock = new DailyNutriCalc();

            // Act
            var actualResult = dailyNutriCalcMock.CalculateCurrentFibers(null);

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