public void DetectCycles() { //Arrange Graph = new DepthFirstSearchImplementation(); //Act Exception exception = Assert.Throws <Exception>(() => Graph.DetectCyclesDFS(InitializeTree().First())); //Assert Assert.That(exception.Message, Is.EqualTo("Cycle detected")); }
public void TraverseIteratively() { //Arrange Graph = new DepthFirstSearchImplementation(); //Act List <string> traverseArrayIterative = Graph.TraverseDFSIteratively(InitializeTree()); //Assert Assert.AreEqual(traverseArrayIterative, new List <string> { "A", "D", "H", "G", "K", "C", "B", "E", "F", "J", "I" }); }