Ejemplo n.º 1
0
        public void MakeMoveTest()
        {
            MyBot target = new MyBot();
            Player testPlayer = new Player("Test", target);
            testPlayer.Reset(GameRules.Default);

            IPlayer opponent = new Player("Opponent", new MyBot());
            Move actual = target.MakeMove(testPlayer, opponent, GameRules.Default);
            Assert.IsNotNull(actual, "This test expected a move to be made.");
        }
Ejemplo n.º 2
0
        public void MyBotShouldWinAgainstRandomBotTest()
        {
            // Arrange
            var me = new TestPlayer();
            var randomPlayer = new TestPlayer();

            var myBot = new MyBot();
            var randomBot = new RandomBot();

            // Act
            var winner = new GameEmulator().PlayMatch(me, myBot, randomPlayer, randomBot);

            // Assert
            Assert.AreSame(me, winner);
        }
        public void DynamiteTiesDynamiteTest()
        {
            // Arrange
            var me = new MyBot();
            var randomBot = new RandomBot();

            var myMove = new BotMove { Player = me, Move = Moves.Dynamite };
            var theirMove = new BotMove { Player = randomBot, Move = Moves.Dynamite };

            // Act
            var winner1 = new GameEmulator().DetermineWinner(myMove, theirMove);
            var winner2 = new GameEmulator().DetermineWinner(theirMove, myMove);

            // Assert
            Assert.IsNull(winner1);
            Assert.IsNull(winner2);
        }
        public void DynamiteBeatsScissorsTest()
        {
            // Arrange
            var me = new MyBot();
            var randomBot = new RandomBot();

            var myMove = new BotMove { Player = me, Move = Moves.Dynamite };
            var theirMove = new BotMove { Player = randomBot, Move = Moves.Scissors };

            // Act
            var winner1 = new GameEmulator().DetermineWinner(myMove, theirMove);
            var winner2 = new GameEmulator().DetermineWinner(theirMove, myMove);

            // Assert
            Assert.AreSame(me, winner1);
            Assert.AreSame(me, winner2);
        }
        public void PaperBeatsRockTest()
        {
            // Arrange
            var me = new MyBot();
            var randomBot = new RandomBot();

            var myMove = new BotMove { Player = me, Move = Moves.Paper };
            var theirMove = new BotMove { Player = randomBot, Move = Moves.Rock };

            // Act
            var winner1 = new GameEmulator().DetermineWinner(myMove, theirMove);
            var winner2 = new GameEmulator().DetermineWinner(theirMove, myMove);

            // Assert
            Assert.AreSame(me, winner1);
            Assert.AreSame(me, winner2);
        }