コード例 #1
0
        public void Initialize()
        {
            var board = new BattleshipBoard();

            board.Initialize(new RandomBoardFiller());
            Assert.Equal(5 + 4 + 3 + 3 + 2, board.Count(s => s != SquareContent.Water));
        }
コード例 #2
0
        public void PlaceShip_Horizontal()
        {
            var board = new BattleshipBoard();

            board.PlaceShip(new BoardIndex(0, 0), 2, Direction.Horizontal);
            Assert.Equal(SquareContent.Ship, board[new BoardIndex(0, 0)]);
            Assert.Equal(SquareContent.Ship, board[new BoardIndex(1, 0)]);
            Assert.Equal(2, board.Count(s => s == SquareContent.Ship));
        }