Пример #1
0
    public bool NegTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("NegTest1: Neither a nor b implements the IComparable interface");

        try
        {
            Comparer <object>   comparer = Comparer <object> .Default;
            MyClassNotCompareTo a        = new MyClassNotCompareTo();
            MyClassNotCompareTo b        = new MyClassNotCompareTo();
            int result = comparer.Compare(b, a);
            TestLibrary.TestFramework.LogError("101", "The ArgumentException was not thrown as expected");
            retVal = false;
        }
        catch (ArgumentException)
        {
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("102", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return(retVal);
    }
Пример #2
0
    public bool NegTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("NegTest1: Neither a nor b implements the IComparable interface");

        try
        {
            Comparer<object> comparer = Comparer<object>.Default;
            MyClassNotCompareTo a = new MyClassNotCompareTo();
            MyClassNotCompareTo b = new MyClassNotCompareTo();
            int result = comparer.Compare(b, a);
            TestLibrary.TestFramework.LogError("101", "The ArgumentException was not thrown as expected");
            retVal = false;
        }
        catch (ArgumentException)
        {
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("102", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }