public void TestSelfDependency() { JobSorter theSorter = new JobSorter(); string jobList = "a =>, b =>, c => c"; string orderedList = ""; var ex = Assert.ThrowsException <Exception>(() => orderedList = theSorter.SortJobs(jobList)); Assert.AreEqual("Jobs can't depend on themselves.", ex.Message); }
public void TestCircularDependenciesInDifferentOrder() { // The job list is the same as for TestCircularDependencies above but in a different order JobSorter theSorter = new JobSorter(); string jobList = "d => a, a => , f => b, c => f, e => , b => c"; string orderedList = ""; var ex = Assert.ThrowsException <Exception>(() => orderedList = theSorter.SortJobs(jobList)); Assert.AreEqual("Jobs can't have circular dependencies.", ex.Message); }