Ejemplo n.º 1
0
        public void GetNodesWithBetweenReturnsNodesOnTheLevelsInTheRange(int levelFrom, int levelTo, int[] expectedNodes)
        {
            var graph = GraphTestHelper.CreateExampleGraph(TargetGraph);

            GraphTestHelper.AssertCollectionsConsistsOfNodes(expectedNodes,
                                                             graph.GetNodesBetween(levelFrom, levelTo));
            GraphTestHelper.AssertNodesAreOrderedByLevel(graph.GetNodesBetween(levelFrom, levelTo));
        }
Ejemplo n.º 2
0
        public void GetNodesReturnsNodesOnTheLevel(int level, int[] expectedNodes)
        {
            var graph = GraphTestHelper.CreateExampleGraph(TargetGraph);

            GraphTestHelper.AssertCollectionsConsistsOfNodes(expectedNodes,
                                                             graph.GetNodes(level));
            GraphTestHelper.AssertNodesAreOrderedByLevel(graph.GetNodes(level));
        }
Ejemplo n.º 3
0
        public void GetNeighboursReturnsNeighboursOfTheNodeInTheRangeOfLevels(int node, int[] expectedNeighbours)
        {
            var graph = GraphTestHelper.CreateExampleGraph(TargetGraph);

            GraphTestHelper.AssertCollectionsConsistsOfNodes(expectedNeighbours,
                                                             graph.Find(node).GetNeighbours(-1, 2));
            GraphTestHelper.AssertNodesAreOrderedByLevel(graph.Find(node).GetNeighbours(-1, 2));
        }
Ejemplo n.º 4
0
        public void DescendantsReturnsDescendantsOfTheNode(int node, int[] expectedDescendants)
        {
            var graph = GraphTestHelper.CreateExampleGraph(TargetGraph);

            GraphTestHelper.AssertCollectionsConsistsOfNodes(expectedDescendants,
                                                             graph.Find(node).Descendants);
            GraphTestHelper.AssertNodesAreOrderedByLevel(graph.Find(node).Descendants);
        }
Ejemplo n.º 5
0
        public void TerminatingPrecedentsReturnsPrecedentsOfTheNodeOnTheZeroLevel(int node, int[] expectedTerminatingPrecedents)
        {
            var graph = GraphTestHelper.CreateExampleGraph(TargetGraph);

            GraphTestHelper.AssertCollectionsConsistsOfNodes(expectedTerminatingPrecedents,
                                                             graph.Find(node).TerminatingPrecedents);
            GraphTestHelper.AssertNodesAreOrderedByLevel(graph.Find(node).TerminatingPrecedents);
        }