Skip to content

Commit

Permalink
Fix ToString method
Browse files Browse the repository at this point in the history
  • Loading branch information
Leroy Korterink committed Oct 27, 2018
1 parent 43254f9 commit 231f1db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Graph/Graph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ public override string ToString()
{
var adjacentVertexes = vertex.AdjacentVertices.Aggregate(
"",
(accumulator, edge) => { return accumulator += $"{edge.Destination.Name}({edge.Cost})"; }
(accumulator, edge) => { return accumulator += $" {edge.Destination.Name}({edge.Cost})"; }
);

output += vertex.Name + " --> " + adjacentVertexes;
output += $"{vertex.Name} -->{adjacentVertexes}\n";
}

return output;
Expand Down
2 changes: 1 addition & 1 deletion GraphTests/GraphTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void Should_ToString()
_output.WriteLine(myGraph.ToString());

Assert.Equal(
"V0 --> V1(2) V3(1)\nV1 --> V3(3) V4(10)\nV2 --> V0(4) V5(5)\nV3 --> V2(2) V5(8) V6(4) V4(2)\nV4 --> V6(6)\nV5 -->\nV6 --> V5(1)\n",
"V0 --> V1(2) V3(1)\nV1 --> V3(3) V4(10)\nV3 --> V2(2) V4(2) V5(8) V6(4)\nV4 --> V6(6)\nV2 --> V0(4) V5(5)\nV5 -->\nV6 --> V5(1)\n",
myGraph.ToString()
);
}
Expand Down

0 comments on commit 231f1db

Please sign in to comment.