Exemple #1
0
        public void DivideZeroToInt()
        {
            GenericCalculator sumTest1 = new GenericCalculator();
            dynamic           num1     = 0;
            dynamic           num2     = 10;

            //Act
            dynamic total = sumTest1.Divide(num1, num2);

            //Assert
            Assert.AreEqual(0, total);
            Assert.Throws <DivideByZeroException>(() => sumTest1.Divide(num1, num2));
        }
Exemple #2
0
        public void DivideDoubles()
        {
            GenericCalculator sumTest1 = new GenericCalculator();
            dynamic           num1     = 15.55;
            dynamic           num2     = 3.33;

            //Act
            dynamic total = sumTest1.Divide(num1, num2);

            //Assert
            Assert.AreEqual(4.66966966966967, total);
        }
Exemple #3
0
        public void Divide()
        {
            GenericCalculator sumTest1 = new GenericCalculator();
            dynamic           num1     = 30;
            dynamic           num2     = 5;

            //Act
            dynamic total = sumTest1.Divide(num1, num2);

            //Assert
            Assert.AreEqual(6, total);
        }