Пример #1
0
        public void TestParentAssignment()
        {
            TestParentable testParentable = new TestParentable();

            testParentable.SetParent(12345);
            Assert.AreEqual(12345, testParentable.GetParent());
        }
Пример #2
0
        public void TestParentChangedNotification()
        {
            TestParentable testParentable = new TestParentable();

            testParentable.SetParent(12345);

            Assert.IsTrue(testParentable.ParentChangedCalled);
        }
Пример #3
0
        public void TestPropagatePreassignedParent()
        {
            TestParentingCollection testCollection = new TestParentingCollection();
            TestParentable          testParentable = new TestParentable();

            testCollection.SetParent(54321);
            testCollection.Add(testParentable);

            Assert.AreEqual(54321, testParentable.GetParent());
        }
Пример #4
0
        public void TestDisposeItems()
        {
            TestParentingCollection testCollection = new TestParentingCollection();
            TestParentable          testParentable = new TestParentable();

            testCollection.Add(testParentable);

            testCollection.DisposeItems();

            Assert.IsTrue(testParentable.DisposeCalled);
        }
Пример #5
0
        public void TestPropagateParentOnReplace()
        {
            TestParentingCollection testCollection  = new TestParentingCollection();
            TestParentable          testParentable1 = new TestParentable();
            TestParentable          testParentable2 = new TestParentable();

            testCollection.SetParent(54321);
            testCollection.Add(testParentable1);
            testCollection[0] = testParentable2;

            Assert.AreEqual(0, testParentable1.GetParent());
            Assert.AreEqual(54321, testParentable2.GetParent());
        }
Пример #6
0
        public void TestUnsetParentOnClear()
        {
            TestParentingCollection testCollection = new TestParentingCollection();
            TestParentable          testParentable = new TestParentable();

            testCollection.Add(testParentable);
            testCollection.SetParent(54321);

            Assert.AreEqual(54321, testParentable.GetParent());

            testCollection.Clear();

            Assert.AreEqual(0, testParentable.GetParent());
        }