using System.Collections.Generic; using NUnit.Framework; namespace Chernobyl.Collections.Generic.Hierarchy { [TestFixture] [Description("Tests the following types: TreeEnumerator, " + "DepthFirstEnumerator, EnumeratorFactory")] public class DepthFirstTreeEnumeratorTests : TreeEnumeratorTests { /// /// This method should return a new that can /// be iterated over five times. The index will be requested from each /// item using . The /// items should return the following index values in exactly this order: /// 1, 2, 3, 4, 5. This method should create a new /// every time it is invoked and not reuse instances. /// protected override IEnumerable CreateManyItemEnumerable() { // Setup the "ManyNodes" foobar, it should look like this: // 0 // /|\ // 1 4 5 // /| | // 2 3 6 Foobar child0 = new Foobar(0); Foobar child1 = new Foobar(1); Foobar child2 = new Foobar(2); Foobar child3 = new Foobar(3); Foobar child4 = new Foobar(4); Foobar child5 = new Foobar(5); Foobar child6 = new Foobar(6); child1.Children.Add(child2); child1.Children.Add(child3); child5.Children.Add(child6); child0.Children.Add(child1); child0.Children.Add(child4); child0.Children.Add(child5); OrderedItemsValue = new[] { child0, child1, child2, child3, child4, child5, child6 }; return child0.DepthFirst; } } }