public void AddBaseInterval() { var tree = new TimingTree(); var owner = new Mock <IIntervalOwner>(); { owner.Setup(o => o.CurrentTicks) .Returns(10L); } var group = new TimingGroup(); using (var interval = new TimerInterval(owner.Object, group, "a")) { interval.Start(); tree.AddBaseInterval(interval); Assert.That( tree.BaseIntervals(group), Is.EquivalentTo( new ITimerInterval[] { interval })); } }
public void CopyTreeCompletely() { var owner = new Mock <IIntervalOwner>(); { owner.Setup(o => o.CurrentTicks) .Returns(10L); } var group = new TimingGroup(); var parents = new ITimerInterval[] { new TimerInterval(owner.Object, group, "a"), new TimerInterval(owner.Object, group, "b"), new TimerInterval(owner.Object, group, "c"), }; var children = new[] { new ITimerInterval[] { new TimerInterval(owner.Object, group, "aa"), new TimerInterval(owner.Object, group, "ab"), new TimerInterval(owner.Object, group, "ac"), }, new ITimerInterval[] { new TimerInterval(owner.Object, group, "ba"), new TimerInterval(owner.Object, group, "bb"), new TimerInterval(owner.Object, group, "bc"), }, new ITimerInterval[] { new TimerInterval(owner.Object, group, "ca"), new TimerInterval(owner.Object, group, "cb"), new TimerInterval(owner.Object, group, "cc"), }, }; var tree = BuildTree(parents, children); var otherTree = new TimingTree(tree); Assert.That(otherTree.BaseIntervals(group), Is.EquivalentTo(parents)); Assert.That(otherTree.ChildIntervals(parents[0]), Is.EquivalentTo(children[0])); Assert.That(otherTree.ChildIntervals(parents[1]), Is.EquivalentTo(children[1])); Assert.That(otherTree.ChildIntervals(parents[2]), Is.EquivalentTo(children[2])); CleanUpIntervals(parents, children); }