public void GetEnumerator_WithChildren_EnumeratesChildren() { // Arrange var nodeDirectory = new Directory(); var child1 = new File() { Name = "Child_1" }; var child2 = new File() { Name = "Child_2" }; var child3 = new File() { Name = "Child_3" }; nodeDirectory.AddChild(child1); nodeDirectory.AddChild(child2); nodeDirectory.AddChild(child3); // Act var enumerator = nodeDirectory.AsEnumerable(); // Assert CollectionAssert.AreEqual(new[] { child1, child2, child3 }, enumerator); }