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()); }
public void TestParentAssignment() { TestParentable testParentable = new TestParentable(); testParentable.SetParent(12345); Assert.AreEqual(12345, testParentable.GetParent()); }
public void TestPropagatePreassignedParent() { TestParentingCollection testCollection = new TestParentingCollection(); TestParentable testParentable = new TestParentable(); testCollection.SetParent(54321); testCollection.Add(testParentable); Assert.AreEqual(54321, testParentable.GetParent()); }
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()); }