Пример #1
0
        public void SubstractionThrowsOverflowExceptionTest()
        {
            // Create instance to test.
            var substract = new Substract();
            // Define a test input and output value.
            var number = new Number {
                NumberOne = int.MaxValue, NumberTwo = int.MinValue
            };

            // Run the method under test.
            Assert.Throws <OverflowException>(() => substract.DoOperation(number));
        }
Пример #2
0
        public void SubstractionTest()
        {
            // Create instance to test.
            var subtract = new Substract();
            // Define a test input and output value.
            var expected = 4 - 10;
            var number   = new Number {
                NumberOne = 4, NumberTwo = 10
            };
            // Run the method under test.
            var actual = subtract.DoOperation(number);

            // Verify the result.
            Assert.AreEqual(expected, actual);
        }