예제 #1
0
        public void TestWhenStoringMovesBeforeMovesAreMade_ThenNothingIsStored()
        {
            var target = new MoveHistory_Accessor();
            IPlayer you = new Player("Test", new MyBot());
            IPlayer opponent = new Player("Opponent", new MyBot());

            target.StoreMoves(you, opponent);
            int expected = 0;
            int actual = target.OpponentMoveHistory.Count;
            Assert.AreEqual(expected, actual, "No opponent move should have been stored as no move was made yet.");
            actual = target.YourMoveHistory.Count;
            Assert.AreEqual(expected, actual, "No move for you should have been stored as no move was made yet.");
        }
예제 #2
0
        public void TestWhenStoringMovesAfterMovesAreMade_ThenMovesAreStored()
        {
            var target = new MoveHistory_Accessor();
            Player you = new Player("Test", new MyBot());
            you.SetLastMove(new PlayerMove(you, Moves.Rock));
            Player opponent = new Player("Opponent", new MyBot());
            opponent.SetLastMove(new PlayerMove(opponent, Moves.WaterBalloon));

            target.StoreMoves(you, opponent);
            Move expected = Moves.WaterBalloon;
            Move actual = target.OpponentMoveHistory[0];
            Assert.AreEqual(expected, actual, "Opponent move was not saved as expected.");
            expected = Moves.Rock;
            actual = target.YourMoveHistory[0];
            Assert.AreEqual(expected, actual, "Your move was not saved as expected.");
        }