Example #1
0
        public void checksub()
        {
            int a        = -4;
            int b        = 4;
            int expected = a - b;
            int actual   = obj.sub(a, b);

            Assert.AreEqual(actual, expected, 0, "Result is wrong");
            int a1 = int.MaxValue;
            int b1 = int.MinValue;

            Assert.ThrowsException <System.OverflowException>(() => obj.sub(a1, b1));
            int a2 = int.MaxValue;
            int b2 = -23;

            Assert.ThrowsException <System.OverflowException>(() => obj.sub(a2, b2));
            int a3 = int.MinValue;
            int b3 = 2;

            Assert.ThrowsException <System.OverflowException>(() => obj.sub(a3, b3));
        }