Example #1
0
        public void ModulusValidInput(int initial, int x, int expected)
        {
            ICalculator calculator = new Calculator();

            calculator.Add(initial);
            calculator.Modulus(x);
            Assert.Equal(expected, calculator.Result);
        }
Example #2
0
        public void ModulusDivideByZeroException()
        {
            ICalculator calculator = new Calculator();

            calculator.Add(5);
            var e = Assert.Throws <DivideByZeroException>(() =>
            {
                calculator.Modulus(0);
            });

            Assert.True(e.Message == "Zero division by modulus.");
        }