Beispiel #1
0
        public void AbsTest()
        {
            int v        = System.Int32.MinValue;
            int expected = 0; // expecting overflow exception
            int actual;

            try
            {
                actual = Generic.Abs(v);
            }
            catch (System.Exception ex)
            {
                Assert.IsInstanceOfType(ex, System.Type.GetType("System.OverflowException"));
            }

            v        = System.Int32.MinValue + 1;
            expected = System.Int32.MaxValue;
            actual   = Generic.Abs(v);
            Assert.AreEqual(expected, actual);
        }