public void SingleNodeViserator() { TestNode tree = CreateSimpleTestTree(); var resultSet = tree.Viserate <TestViserator, TestResult, TestNode, TestComponent>(); Assert.Collection(resultSet, resultItem => Assert.Equal(new TestResult { Depth = 1, Path = "/RootNode/[2]" }, resultItem), resultItem => Assert.Equal(new TestResult { Depth = 1, Path = "/RootNode/[6]" }, resultItem), resultItem => Assert.Equal(new TestResult { Depth = 2, Path = "/RootNode/ChildNode/[3]" }, resultItem), resultItem => Assert.Equal(new TestResult { Depth = 2, Path = "/RootNode/ChildNumberTwo/[4]" }, resultItem) ); }
// Find nodes containing matching components by type (and predicate) public static IEnumerable <TestNode> FindNodesWhereComponent <TComponentToFind>(this TestNode root, Predicate <TComponentToFind> match) where TComponentToFind : TestComponent => root.FindNodesWhereComponent <TComponentToFind, TestNode, TestComponent>(match);
// Find nodes containing matching components by predicate only public static IEnumerable <TestNode> FindNodesWhereComponent(this TestNode root, Predicate <TestComponent> match) => root.FindNodesWhereComponent <TestNode, TestComponent>(match);
// Find Components by predicate only public static IEnumerable <TestComponent> FindComponents(this TestNode root, Predicate <TestComponent> match) => root.FindComponents <TestNode, TestComponent>(match);