Пример #1
0
        public void TestAcyclicTopDownOrder()
        {
            IDictionary<string, ICollection<string>> graph = new LinkedHashMap<string, ICollection<string>>();

            Add(graph, "1_1", "R2");
            Add(graph, "A", "R1");
            Add(graph, "A", "R2");
            EPAssertionUtil.AssertEqualsExactOrder(new [] { "R1","R2","1_1","A" }, GraphUtil.GetTopDownOrder(graph).ToArray());

            Add(graph, "R1", "R2");
            EPAssertionUtil.AssertEqualsExactOrder(new [] { "R2","1_1","R1","A" }, GraphUtil.GetTopDownOrder(graph).ToArray());

            Add(graph, "1_1", "A");
            EPAssertionUtil.AssertEqualsExactOrder(new [] { "R2","R1","A","1_1" }, GraphUtil.GetTopDownOrder(graph).ToArray());

            Add(graph, "0", "1_1");
            EPAssertionUtil.AssertEqualsExactOrder(new [] { "R2","R1","A","1_1","0" }, GraphUtil.GetTopDownOrder(graph).ToArray());

            Add(graph, "R1", "0");
            TryInvalid(graph, "Circular dependency detected between [\"0\", \"R1\", \"A\", \"1_1\"]");
        }