public void TestParentAssignment()
        {
            TestParentable testParentable = new TestParentable();

            testParentable.SetParent(12345);
            Assert.AreEqual(12345, testParentable.GetParent());
        }
        public void TestParentChangedNotification()
        {
            TestParentable testParentable = new TestParentable();

            testParentable.SetParent(12345);

            Assert.IsTrue(testParentable.ParentChangedCalled);
        }
        public void TestPropagatePreassignedParent()
        {
            TestParentingCollection testCollection = new TestParentingCollection();
            TestParentable          testParentable = new TestParentable();

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

            Assert.AreEqual(54321, testParentable.GetParent());
        }
        public void TestDisposeItems()
        {
            TestParentingCollection testCollection = new TestParentingCollection();
            TestParentable          testParentable = new TestParentable();

            testCollection.Add(testParentable);

            testCollection.DisposeItems();

            Assert.IsTrue(testParentable.DisposeCalled);
        }
        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());
        }
        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());
        }