コード例 #1
0
ファイル: MyBotTest.cs プロジェクト: artlucia/RockMeAzuredeus
        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.");
        }
コード例 #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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }