public void DefaultBoardHas4LumberTiles() { var builder = new DefaultBoardBuilder(); builder.Build(); var tiles = builder.Tiles.Where(t => t.Rawmaterial == MaterialType.Lumber).ToArray(); Assert.Equal(4, tiles.Length); }
public void DefaultBoardHas19Tiles() { var builder = new DefaultBoardBuilder(); builder.Build(); var tiles = builder.Tiles.Where(t => t.Rawmaterial != MaterialType.Sea).ToArray(); Assert.Equal(19, tiles.Length); }
public void DefaultBoardHas1Desert() { var builder = new DefaultBoardBuilder(); builder.Build(); var tiles = builder.Tiles.Where(t => t.Rawmaterial == MaterialType.Unsourced).ToArray(); Assert.Equal(1, tiles.Length); }
public void EachHarborHasUniqueTile() { var builder = new DefaultBoardBuilder(); builder.Build(); foreach (var harbor in builder.Harbors) { Assert.Equal(1, builder.Harbors.Count(h => h.Tile == harbor.Tile)); } }
public void DefaultBoardHas9Harbors() { var builder = new DefaultBoardBuilder(); builder.Build(); Assert.Equal(9, builder.Harbors.Count()); Assert.Equal(4, builder.Harbors.Count(h => h.Discount == MaterialType.Unsourced)); foreach(var value in Enum.GetValues(typeof(MaterialType)).OfType<MaterialType>() .Except(new MaterialType[] { MaterialType.Unsourced, MaterialType.Sea })) { Assert.Equal(1, builder.Harbors.Count(h => h.Discount == value)); } }
public void TestEachTileHas2Vertices() { var builder = new DefaultBoardBuilder(); builder.Build(); foreach (var tile in builder.Tiles) { var vertices = builder.Vertices.Where(vertice => vertice.X == tile.X && vertice.Y == tile.Y).ToArray(); Assert.Equal(2, vertices.Length); Assert.Equal(new[] { VertexTileSide.Left, VertexTileSide.Right }, vertices.Select(e => e.Side).ToArray()); } }
public void TestEachTileHas3Edges() { var builder = new DefaultBoardBuilder(); builder.Build(); foreach(var tile in builder.Tiles) { var edges = builder.Edges.Where(edge => edge.X == tile.X && edge.Y == tile.Y).ToArray(); Assert.Equal(3, edges.Length); Assert.Equal(new[] { EdgeSide.East, EdgeSide.North, EdgeSide.West }, edges.Select(e => e.Side).ToArray()); } }
public void DefaultBoardHasCorrectNumbers() { var builder = new DefaultBoardBuilder(); builder.Build(); //array would be cleaner... Assert.Equal(1, builder.Tiles.Count(t => t.Number == 2)); Assert.Equal(2, builder.Tiles.Count(t => t.Number == 3)); Assert.Equal(2, builder.Tiles.Count(t => t.Number == 4)); Assert.Equal(2, builder.Tiles.Count(t => t.Number == 5)); Assert.Equal(2, builder.Tiles.Count(t => t.Number == 6)); Assert.Equal(1, builder.Tiles.Count(t => t.Number == 7)); Assert.Equal(2, builder.Tiles.Count(t => t.Number == 8)); Assert.Equal(2, builder.Tiles.Count(t => t.Number == 9)); Assert.Equal(2, builder.Tiles.Count(t => t.Number == 10)); Assert.Equal(2, builder.Tiles.Count(t => t.Number == 11)); Assert.Equal(1, builder.Tiles.Count(t => t.Number == 12)); }