Пример #1
0
        public static void ArithmeticOperation_Test2(ArithmeticOpetation op, int a, int b)
        {
            //arrange
            int expected = a;
            var result   = new CalcResult <int>(a);
            var _b       = new CalcResult <int>(b);

            //act
            if (op == ArithmeticOpetation.Add)
            {
                result.Add(_b);
                expected += b;
            }

            if (op == ArithmeticOpetation.Subtract)
            {
                result.Subtract(_b);
                expected -= b;
            }

            if (op == ArithmeticOpetation.Multiply)
            {
                result.Multiply(_b);
                expected *= b;
            }

            if (op == ArithmeticOpetation.Divide)
            {
                result.Divide(_b);
                expected /= b;
            }

            //assert
            Assert.Equal(expected, result.Value);
        }
Пример #2
0
        public static void Operators_Test(ArithmeticOpetation op, int a, int b)
        {
            //arrange
            int expected = a;
            var result   = new CalcResult <int>(a);

            //act
            if (op == ArithmeticOpetation.Add)
            {
                result   += b;
                expected += b;
            }

            if (op == ArithmeticOpetation.Subtract)
            {
                result   -= b;
                expected -= b;
            }

            if (op == ArithmeticOpetation.Multiply)
            {
                result   *= b;
                expected *= b;
            }

            if (op == ArithmeticOpetation.Divide)
            {
                result   /= b;
                expected /= b;
            }

            //assert
            Assert.Equal(expected, result.Value);
        }