Beispiel #1
0
        public void TestArithmaticOverflowSubtraction()
        {
            _userCalculator = new UserCalculator();
            double leftOperand  = Double.MinValue;
            double rightOperand = Double.MaxValue;

            Assert.ThrowsException <ArithmeticException>(() => _userCalculator.PerformOperation(Operator.SUBTRACT, leftOperand, rightOperand));
        }
Beispiel #2
0
        public void TestArithmaticOverflowMultiplication()
        {
            _userCalculator = new UserCalculator();
            double leftOperand  = Double.MaxValue;
            double rightOperand = Double.MaxValue;

            Assert.ThrowsException <ArithmeticException>(() => _userCalculator.PerformOperation(Operator.MULTIPLY, leftOperand, rightOperand));
        }
Beispiel #3
0
        public void TestDivideByZero()
        {
            _userCalculator = new UserCalculator();
            double leftOperand  = 35;
            double rightOperand = 0;

            Assert.ThrowsException <DivideByZeroException>(() => _userCalculator.PerformOperation(Operator.DIVIDE, leftOperand, rightOperand));
        }
Beispiel #4
0
        public void TestDivide()
        {
            _userCalculator = new UserCalculator();
            double leftOperand  = 35;
            double rightOperand = 5;

            Assert.AreEqual(7, _userCalculator.PerformOperation(Operator.DIVIDE, leftOperand, rightOperand));
        }
Beispiel #5
0
        public void TestMultiply()
        {
            _userCalculator = new UserCalculator();
            double leftOperand  = 35;
            double rightOperand = 5;

            Assert.AreEqual(175, _userCalculator.PerformOperation(Operator.MULTIPLY, leftOperand, rightOperand));
        }
Beispiel #6
0
        public void TestSubtract()
        {
            _userCalculator = new UserCalculator();
            double leftOperand  = 35;
            double rightOperand = 5;

            Assert.AreEqual(30, _userCalculator.PerformOperation(Operator.SUBTRACT, leftOperand, rightOperand));
        }
Beispiel #7
0
        public void TestAdd()
        {
            _userCalculator = new UserCalculator();
            double leftOperand  = 35;
            double rightOperand = 5;

            Assert.AreEqual(40, _userCalculator.PerformOperation(Operator.ADD, leftOperand, rightOperand));
        }