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

            board.PlaceShip(new BoardIndex(0, 0), 1, Direction.Horizontal);
            Assert.Equal(SquareContent.Ship, board[0]);
            Assert.Equal(SquareContent.Water, board[99]);
        }
コード例 #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));
        }