コード例 #1
0
        public void TestPropagatePreassignedParent()
        {
            TestParentingCollection testCollection = new TestParentingCollection();
            TestParentable          testParentable = new TestParentable();

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

            Assert.AreEqual(54321, testParentable.GetParent());
        }
コード例 #2
0
        public void TestDisposeItems()
        {
            TestParentingCollection testCollection = new TestParentingCollection();
            TestParentable          testParentable = new TestParentable();

            testCollection.Add(testParentable);

            testCollection.DisposeItems();

            Assert.IsTrue(testParentable.DisposeCalled);
        }
コード例 #3
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());
        }
コード例 #4
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());
        }