public void InputsTopologicalSort_WhenAcyclicGraph_ThenTopologicalOrder()
        {
            // given
            DirectedSimpleGraph <int, object, object> graph = new DirectedSimpleGraph <int, object, object>(
                Enumerable.Range(0, 6).ToArray());

            graph.AddEdgeBetween(graph[0], graph[2]);
            graph.AddEdgeBetween(graph[0], graph[4]);
            graph.AddEdgeBetween(graph[1], graph[0]);
            graph.AddEdgeBetween(graph[1], graph[4]);
            graph.AddEdgeBetween(graph[3], graph[1]);
            graph.AddEdgeBetween(graph[3], graph[0]);
            graph.AddEdgeBetween(graph[3], graph[2]);
            graph.AddEdgeBetween(graph[5], graph[1]);
            graph.AddEdgeBetween(graph[5], graph[2]);
            graph.AddEdgeBetween(graph[5], graph[4]);
            // when
            IEnumerable <Vertex <int> > result = TopologicalSorting.InputsTopologicalSort(graph);

            // then
            result.Should().ContainInOrder(graph[3], graph[5], graph[1], graph[0], graph[2], graph[4]);
        }
        public void InputsTopologicalSort_WhenCyclicGraph_ThenDirectedCyclicGraphException()
        {
            // given
            DirectedSimpleGraph <int, object, object> graph = new DirectedSimpleGraph <int, object, object>(
                Enumerable.Range(0, 6).ToArray());

            graph.AddEdgeBetween(graph[0], graph[2]);
            graph.AddEdgeBetween(graph[0], graph[4]);
            graph.AddEdgeBetween(graph[1], graph[0]);
            graph.AddEdgeBetween(graph[1], graph[4]);
            graph.AddEdgeBetween(graph[2], graph[1]);
            graph.AddEdgeBetween(graph[3], graph[1]);
            graph.AddEdgeBetween(graph[3], graph[0]);
            graph.AddEdgeBetween(graph[3], graph[2]);
            graph.AddEdgeBetween(graph[5], graph[1]);
            graph.AddEdgeBetween(graph[5], graph[2]);
            graph.AddEdgeBetween(graph[5], graph[4]);
            // when
            Action action = () => TopologicalSorting.InputsTopologicalSort(graph);

            // then
            action.Should().Throw <DirectedCyclicGraphException>();
        }