public void GetLongestRoadTest(IEnumerable<EdgeCoordinate> coordinates, int expectedResult) { var board = new Board(builder); var player1 = new Mock<IPlayer>(); player1.Setup(p => p.HasResources(Establishment.BUILD_RESOURCES)).Returns(true); //Carefull with setup, all roads should be connected to those 2 establishments var vertex1 = builder.Vertices.First(t => t.X == 0 && t.Y == 0 && t.Side == VertexTileSide.Left); var vertex2 = builder.Vertices.First(t => t.X == 2 && t.Y == 0 && t.Side == VertexTileSide.Left); board.BuildEstablishment(vertex1, player1.Object); board.BuildEstablishment(vertex2, player1.Object); foreach (var coordinate in coordinates) { var edge = board.FindEdge(coordinate.X, coordinate.Y, coordinate.Side); board.BuildRoad(edge, player1.Object); } var result = board.GetLongestRoad(player1.Object); Assert.Equal(expectedResult, result.Count()); }
public void LongestRoadFailsIfPlayerNull() { var board = new Board(builder); Assert.Throws<ArgumentNullException>(() => board.GetLongestRoad(null)); }