コード例 #1
0
        public void AdvanceMovesFirstPlayerToLastPosition()
        {
            PlayerDeque deque = new PlayerDeque(generator, playerFactory);
            var         first = deque[0];

            deque.AdvanceDeque();
            Assert.AreEqual(first, deque[deque.Count - 1]);
        }
コード例 #2
0
        public void TakeTurnAdvancesPlayerAndPushesHimToBackOfDeque()
        {
            PlayerDeque deque    = new PlayerDeque(generator, playerFactory);
            var         first    = deque[0];
            var         position = first.Position;

            deque.TakeTurn();
            Assert.AreNotEqual(position, first.Position);
            Assert.AreEqual(first, deque[deque.Count - 1]);
        }
コード例 #3
0
        public void ShuffleReordersPlayers()
        {
            // Unfortunately the shuffled version with this generator is the same :(
            string[] shuffledPlayers = new string[]
            {
                players[0],
                players[1],
                players[2],
                players[3],
            };

            PlayerDeque deque = new PlayerDeque(generator, playerFactory);

            Assert.IsTrue(shuffledPlayers.SequenceEqual(deque.Select(x => x.Name).ToArray()));
        }
コード例 #4
0
        public void Setup()
        {
            generator = new RandomGeneratorMoc();
            string[] properties =
            {
                "a", "b", "c"
            };

            gameBoard = new Board(new PropertyFactory(properties));
            string[] players =
            {
                "a", "b", "c", "d", "e"
            };

            playerDeque  = new PlayerDeque(generator, new PlayerFactory(players, generator, gameBoard));
            game         = new Game(gameBoard);
            game.Players = playerDeque;
        }