public void TestConstructor() { Network net = new Network("..\\..\\..\\test.txt", RandNext); Assert.AreEqual(net.NumberOfComputers, 5); Assert.AreEqual(net.ListOfComputers[2].OperationSystem, Computer.OS.Mac); Graph g = new Graph(5); g.AddEdge(0, 1); g.AddEdge(1, 2); g.AddEdge(1, 3); g.AddEdge(3, 4); for (int i = 0; i < 5; ++i) for (int j = 0; j < 5; ++j) Assert.AreEqual(g.GetMatrix()[i][j], net.Graph.GetMatrix()[i][j]); }
public void TestTraverse2() { Graph g = new Graph(4); g.AddEdge(0, 2); g.AddEdge(1, 2); g.AddEdge(1, 3); Stack<int> s = g.Traverse(); int[] arr = { 3, 1, 2, 0 }; int count = 0; foreach (int x in s) { Assert.AreEqual(x, arr[count]); count++; } }