コード例 #1
0
        public void ThreeInARightToLeftDiagonalWins()
        {
            var naughts = new PrepopulatedPlayerStub(new[]
                {
                    new BoardPosition(1, 3),
                    new BoardPosition(2, 2),
                    new BoardPosition(3, 1),
                });
            var crosses = new PrepopulatedPlayerStub(new[]
                {
                    new BoardPosition(1, 2),
                    new BoardPosition(3, 2),
                });
            var game = new TicTacToeGame(naughts, crosses);

            game.Play();

            Assert.That(game.IsFinished);
            Assert.That(game.Winner, Is.EqualTo(game.Naughts));
        }
コード例 #2
0
        public void WhenBoardIsFullButNobodyHasWonPlayersDraw()
        {
            var naughts = new PrepopulatedPlayerStub(new[]
                {
                    new BoardPosition(1, 1),
                    new BoardPosition(1, 3),
                    new BoardPosition(2, 1),
                    new BoardPosition(3, 2),
                    new BoardPosition(3, 3),
                });
            var crosses = new PrepopulatedPlayerStub(new[]
                {
                    new BoardPosition(1, 2),
                    new BoardPosition(2, 2),
                    new BoardPosition(2, 3),
                    new BoardPosition(3, 1),
                });
            var game = new TicTacToeGame(naughts, crosses);

            game.Play();

            Assert.That(game.IsFinished);
            Assert.That(game.Winner, Is.EqualTo(null));
        }