示例#1
0
        public void TopologicalSort_AlignsTheVerticesAsExpected([NotNull] string relationships, string expected)
        {
            var graph  = new LiteralGraph(relationships, true);
            var result = graph.TopologicalSort().ToList();
            var actual = string.Join(",", result);

            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void TopologicalSort_ThrowsException_ForUndirectedGraph()
        {
            var graph = new LiteralGraph("A-1-B", false);

            Assert.Throws <InvalidOperationException>(() => graph.TopologicalSort());
        }
示例#3
0
        public void TopologicalSort_ThrowsException_ForDirectedGraphWith([NotNull] string relationships)
        {
            var graph = new LiteralGraph(relationships, true);

            Assert.Throws <InvalidOperationException>(() => graph.TopologicalSort());
        }