コード例 #1
0
        public void Divisions_divide4by0_returnsInfinity()
        {
            var uut = new CalculatorClass.Calculator();

            var ex =
                Assert.Catch <DivideByZeroException>(() => uut.Divide(5, 0));
        }
コード例 #2
0
        public void Divisions_divide5by0_throwsDivZeroError()
        {
            var uut = new CalculatorClass.Calculator();

            var ex =
                Assert.Catch <DivideByZeroException>(() => uut.Divide(5, 0));
        }
コード例 #3
0
        public double DivisionWithTestCase_MultiplyWithInitializedAccumulator_ReturnsResult(double divisor)
        {
            var uut = new CalculatorClass.Calculator();

            uut.Add(4); // Accumulator = 4 - Given that Add works as proposed.

            return(uut.Divide(divisor));
        }
コード例 #4
0
        public void Divisions_divide9by3_returns3()
        {
            var uut = new CalculatorClass.Calculator();

            Assert.That(uut.Divide(9, 3), Is.EqualTo(3));
        }
コード例 #5
0
        public double DivisionWithTestCase_MultiplyWithUninitializedAccumulator_ReturnsResult(double divisor)
        {
            var uut = new CalculatorClass.Calculator();

            return(uut.Divide(divisor));
        }
コード例 #6
0
        public void Divisions_divide5by2_returnsMinus2point5()
        {
            var uut = new CalculatorClass.Calculator();

            Assert.That(uut.Divide(5, 2), Is.EqualTo(2.5));
        }