public void CanAddEdgeTest() { VertexGraph graph = new VertexGraph(); Vertex startVertex = new Vertex(); Vertex endVertex = new Vertex(); graph.AddVertex(startVertex); graph.AddVertex(endVertex); int weight = 5; graph.AddEdge(startVertex, endVertex, weight); Assert.Equal(startVertex, graph.AddEdge(startVertex, endVertex, weight)); }
public void CanGetAllNeighborsTest() { VertexGraph graph = new VertexGraph(); Vertex vertexA = new Vertex(); Vertex vertexB = new Vertex(); graph.AddVertex(vertexA); graph.AddVertex(vertexB); int weight = 5; graph.AddEdge(vertexA, vertexB, weight); List <Vertex> neighbors = new List <Vertex>() { vertexB }; Assert.Equal(neighbors, graph.GetNeighbors(vertexA)); }