예제 #1
0
        public async Task Redo_WalkMoveShouldBreakFurtherRedoMoves()
        {
            var stat = new MoqStatictics();
            var game = GetSubject(gameStatistics: stat);

            stat.Append(null, game); //append initial board as well

            var player1 = new PresetTestPlayer(GameSide.Black,
                                               PresetTestPlayer.FirstWalkMove,
                                               PresetTestPlayer.FirstWalkMove,
                                               PresetTestPlayer.UndoMove,
                                               PresetTestPlayer.UndoMove,
                                               PresetTestPlayer.FirstWalkMove,
                                               PresetTestPlayer.RedoMove);
            var player2 = new PresetTestPlayer(GameSide.Red,
                                               PresetTestPlayer.FirstWalkMove,
                                               PresetTestPlayer.FirstWalkMove,
                                               PresetTestPlayer.FirstWalkMove);

            game.Start(player1, player2);
            await game;

            Assert.Equal(GameStatus.Error, game.Status);
            Assert.IsType <NoSuchMoveException>(game.Error);
        }
예제 #2
0
        public async Task Undo_FirstMove()
        {
            var stat = new MoqStatictics();
            var game = GetSubject(gameStatistics: stat);

            stat.Append(null, game); //append initial board as well

            var player1 = new PresetTestPlayer(GameSide.Black,
                                               PresetTestPlayer.FirstWalkMove,
                                               PresetTestPlayer.UndoMove);
            var player2 = new PresetTestPlayer(GameSide.Red,
                                               PresetTestPlayer.FirstWalkMove);

            game.Start(player1, player2);
            await game;

            Assert.Equal(5, stat.BoardHistory.Count); //init board + 3 moves + terminal board
            Assert.Equal(stat.BoardHistory[0], game.Board);
            Assert.Equal(0u, game.Turn);
            Assert.Equal(player1, game.CurrentPlayer);
        }