public void EventDataSet_AddChild_SimpleAdd() { EventDataSet testSet = new EventDataSet(); EventDataSet childSet = new EventDataSet(); testSet.AddChild(childSet); Assert.AreEqual(true, testSet.HasChildren, "hasChildren not properly updated."); Assert.AreEqual(childSet.ObjectId, testSet.m_Children[childSet.ObjectId].ObjectId, "Child not successfully retrieved from dictionary. "); }
public void EventDataSet_HasDataAfterFrame_ProperBehaviorOnChildHasNoStreamCase() { EventDataSet parentSet = new EventDataSet(); EventDataSet childSet = new EventDataSet(); Assert.AreEqual(false, parentSet.HasDataAfterFrame(0), "HasDataAfterFrame should always be false for a dataset with no streams and no children."); Assert.AreEqual(false, childSet.HasDataAfterFrame(0), "HasDataAfterFrame should always be false for a dataset with no streams and no children."); parentSet.AddChild(childSet); Assert.AreEqual(false, parentSet.HasDataAfterFrame(0), "HasDataAfterFrame should always be false for a dataset with no streams and a child that has no samples/streams."); }
public void EventDataSet_HasDataAfterFrame_ProperBehaviorOnChildHasStreamCase() { EventDataSet parentSet = new EventDataSet(); EventDataSet childSet = new EventDataSet(); childSet.AddSample(0, 0, 1); Assert.AreEqual(false, parentSet.HasDataAfterFrame(0), "HasDataAfterFrame should always be false for a dataset with no streams and no children."); Assert.AreEqual(true, childSet.HasDataAfterFrame(0), "HasDataAfterFrame should return true because the last sample of one of it's streams is nonzero."); parentSet.AddChild(childSet); Assert.AreEqual(true, parentSet.HasDataAfterFrame(0), "HasDataAfterFrame returned false even though a child EventDataSet has data past frame 0."); }
public void EventDataSet_AddChild_ConfirmChildObjectConsistentWithReference() { EventDataSet parentSet1 = new EventDataSet(); EventDataSet parentSet2 = new EventDataSet(); EventDataSet childSet = new EventDataSet(); parentSet1.AddChild(childSet); parentSet2.AddChild(childSet); childSet.DisplayName = "SameChild"; Assert.AreEqual("SameChild", parentSet1.m_Children[childSet.ObjectId].DisplayName, "Display name not changed in m_Children despite being changed on child EventDataSet itself."); Assert.AreEqual("SameChild", parentSet2.m_Children[childSet.ObjectId].DisplayName, "Display name not changed in m_Children despite being changed on child EventDataSet itself."); }
public void EventDataSet_RemoveChild_SimpleAddRemove() { EventDataSet parentSet = new EventDataSet(); EventDataSet childSet = new EventDataSet(); parentSet.AddChild(childSet); Assert.AreEqual(true, parentSet.HasChildren, "HasChildren should be true after a child is added. "); parentSet.RemoveChild(childSet.ObjectId); Assert.AreEqual(false, parentSet.HasChildren, "HasChildren should be false after child is removed. "); Assert.IsNull(parentSet.m_Children, "m_Children should be set to null after last child is removed. "); }
public void EventDataSet_HasRefcountAfterFrame_ReturnsTrueOnChildCase() { EventDataSet testSet = new EventDataSet(); testSet.AddSample((int)ResourceManager.DiagnosticEventType.AsyncOperationReferenceCount, 2, 1); testSet.AddSample((int)ResourceManager.DiagnosticEventType.AsyncOperationReferenceCount, 4, 0); EventDataSet childSet = new EventDataSet(); childSet.AddSample((int)ResourceManager.DiagnosticEventType.AsyncOperationReferenceCount, 5, 1); testSet.AddChild(childSet); Assert.AreEqual(true, testSet.HasRefcountAfterFrame(3, true), "Child refcount not properly considered when checking parent's refcount."); }