private static void _ComplexCases(string[] dependency) { var target = new TopologicalSort(); string actual = target.Solve(dependency); foreach (var item in dependency) { string[] split = item.Split(','); Assert.IsTrue(actual.IndexOf(split[0]) < actual.IndexOf(split[1])); } }
public void BasicDependencyCase() { var dependency = new string[] { "a,b", "b,c", "c,d" }; string expected = "a,b,c,d"; var target = new TopologicalSort(); string actual = target.Solve(dependency); Assert.AreEqual(expected, actual); }
public void MultiplePossibleDependencyCase() { var dependency = new string[] { "a,b", "c,b", }; string[] expected = { "a,c,b", "c,a,b", }; var target = new TopologicalSort(); string actual = target.Solve(dependency); Assert.IsTrue(expected.Contains(actual)); }