Beispiel #1
0
            public void SimpleDivisionTest()
            {
                SimpleMathOperation SMO = new SimpleMathOperation();
                int operandA            = Convert.ToInt32(_controller.AcceptCharacter('3'));
                int operandB            = Convert.ToInt32(_controller.AcceptCharacter('1'));
                int result = SMO.Divide(operandA, operandB);

                Assert.AreEqual(3, result);
            }
 public void SimpleMultiplicationTest()
 {
     SimpleMathOperation smo = new SimpleMathOperation();
     _controller.AcceptCharacter('3');
     int operandA = Convert.ToInt32(_controller.GetOutput());
     _controller.AcceptCharacter('1');
     int operandB = Convert.ToInt32(_controller.GetOutput());
     int result = smo.Multiply(operandA, operandB);
     Assert.AreEqual(3, result);
 }
Beispiel #3
0
            public void Disable_SimpleDivisionTest()
            {
                SimpleMathOperation smo = new SimpleMathOperation();

                _controller.AcceptCharacter('3');
                int operandA = Convert.ToInt32(_controller.GetOutput());

                _controller.AcceptCharacter('1');
                int operandB = Convert.ToInt32(_controller.GetOutput());
                int result   = smo.Divide(operandA, operandB);
                // Assert.AreEqual(3, result);      does not match assignment
            }
Beispiel #4
0
            public void SimpleMultiplicationTest()
            {
                SimpleMathOperation smo = new SimpleMathOperation();

                _controller.AcceptCharacter('3');
                int operandA = Convert.ToInt32(_controller.GetOutput());

                _controller.AcceptCharacter('1');
                int operandB = Convert.ToInt32(_controller.GetOutput());
                int result   = smo.Multiply(operandA, operandB);

                Assert.AreEqual(3, result);
            }
            public void SimpleAdditionTest()
            {
                SimpleMathOperation smo = new SimpleMathOperation();
                _controller.AcceptCharacter('3');
                int operandA = Convert.ToInt32(_controller.GetOutput());

                _controller.AcceptCharacter('1');
                // You may want to use "calc" to verify what the current state of the calculator is after you
                // enter "3" and then "1".
                int operandB = Convert.ToInt32(_controller.GetOutput());

                // This is testing the SimpleMathOperation class more than it is testing the CalculatorController
                // class.  Rather than writing a SimpleMathOperation class, try figuring out what intputs you
                // would need to give to the _controller CalculatorController instance in order to get its
                // output to be "4".
                int result = smo.Add(operandA, operandB);
                Assert.AreEqual(4, result);
            }
Beispiel #6
0
            public void Disable_SimpleAdditionTest()
            {
                SimpleMathOperation smo = new SimpleMathOperation();

                _controller.AcceptCharacter('3');
                int operandA = Convert.ToInt32(_controller.GetOutput());

                _controller.AcceptCharacter('1');
                // You may want to use "calc" to verify what the current state of the calculator is after you
                // enter "3" and then "1".
                int operandB = Convert.ToInt32(_controller.GetOutput());

                // This is testing the SimpleMathOperation class more than it is testing the CalculatorController
                // class.  Rather than writing a SimpleMathOperation class, try figuring out what intputs you
                // would need to give to the _controller CalculatorController instance in order to get its
                // output to be "4".
                int result = smo.Add(operandA, operandB);
                // Assert.AreEqual(4, result);   does not match assignment
            }