예제 #1
0
        public void PosTest2()
        {
            MyTestListICollection <int> myList = new MyTestListICollection <int>();
            bool expectValue = true;
            bool returnValue = ((ICollection <int>)myList).IsReadOnly;

            Assert.Equal(expectValue, returnValue);
        }
    // Returns true if the expected result is right
    // Returns false if the expected result is wrong

    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: In the user define implementation of List, this property IsReadOnly may return true.");
        try
        {
            MyTestListICollection <int> myList = new MyTestListICollection <int>();
            bool expectValue = true;
            bool returnValue = ((ICollection <int>)myList).IsReadOnly;
            if (expectValue != returnValue)
            {
                TestLibrary.TestFramework.LogError("002.1", " Calling IsReadOnly property should return true");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002.0", "Unexpected exception: " + e);
            retVal = false;
        }

        return(retVal);
    }