Пример #1
0
        public void ToString_EmptyBoard_DrawsBoard()
        {
            // arrange
            var board = new CrossesBoard();

            // act
            var output = BoardVisualiser.ToString(board);

            // assert
            Assert.That(output, Is.EqualTo(@"
    0   1   2
  ┌───┬───┬───┐
0 │   │   │   │
  ├───┼───┼───┤
1 │   │   │   │
  ├───┼───┼───┤
2 │   │   │   │
  └───┴───┴───┘
"));
        }
Пример #2
0
        public void ToString_BoardWithMixedTokens_DrawsBoard()
        {
            // arrange
            var board = new CrossesBoard();

            board.SetToken(GameToken.Player1, new BoardPosition(0, 0));
            board.SetToken(GameToken.Player2, new BoardPosition(1, 2));
            board.SetToken(GameToken.Player1, new BoardPosition(2, 1));

            // act
            var output = BoardVisualiser.ToString(board);

            // assert
            Assert.That(output, Is.EqualTo(@"
    0   1   2
  ┌───┬───┬───┐
0 │ X │   │   │
  ├───┼───┼───┤
1 │   │   │ X │
  ├───┼───┼───┤
2 │   │ O │   │
  └───┴───┴───┘
"));
        }