public void Recurse() { var r1 = new Recursive(1, new Recursive(2, new Recursive(4)), new Recursive(3)); var recursives = r1.Recurse(r => r.Recursives).ToArray(); Assert.IsTrue(recursives.Select(x => x.Value).SequenceEqual(new[] { 1, 2, 4, 3 })); }
public void TestRecursivePopulationThreeLevel() { var r1 = new Recursive(1, new Recursive(2, new Recursive(4)), new Recursive(3)); var recursives = r1.Recurse(r => r.Recursives).ToArray(); Assert.AreEqual(4, recursives.Length); Assert.IsTrue(recursives.Select(x => x.Value).SequenceEqual(new[] { 1, 2, 4, 3 })); }