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

                Assert.AreEqual(4, 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 #3
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
            }