示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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));
            }
        }
示例#5
0
        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));
            }
        }
示例#6
0
        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());
            }
        }
示例#7
0
        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());
            }
        }
示例#8
0
 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));
 }