Exemple #1
0
        public void TestAdvancePlayerSecond()
        {
            var players = new List <IPlayer>
            {
                new Player("1", Color.Red),
                new Player("2", Color.Blue),
                new Player("3", Color.Yellow),
                new Player("4", Color.Green)
            };
            var gameService = new GameService();

            gameService.StartGame(players);

            const int piece       = 1;
            const int playerIndex = 2;

            var rolled   = gameService.RollDie(players.ElementAt(playerIndex));
            var position = players.ElementAt(playerIndex).Pieces.ElementAt(piece);

            Assert.Equal(-1, position);

            gameService.Advance(players.ElementAt(playerIndex), piece);

            Assert.Equal(rolled + ColorPositions.StartPosition(players.ElementAt(playerIndex).Color),
                         players.ElementAt(playerIndex).Pieces.ElementAt(piece));
        }
Exemple #2
0
        public void GetStartPositionYellow()
        {
            const Color color = Color.Yellow;

            var startPosition = ColorPositions.StartPosition(color);

            Assert.Equal(20, startPosition);
        }
Exemple #3
0
        public void GetStartPositionRed()
        {
            const Color color = Color.Red;

            var startPosition = ColorPositions.StartPosition(color);

            Assert.Equal(0, startPosition);
        }
Exemple #4
0
        public void GetStartPositionGreen()
        {
            const Color color = Color.Green;

            var startPosition = ColorPositions.StartPosition(color);

            Assert.Equal(30, startPosition);
        }
Exemple #5
0
        public void GetStartPositionBlue()
        {
            const Color color = Color.Blue;

            var startPosition = ColorPositions.StartPosition(color);

            Assert.Equal(10, startPosition);
        }
Exemple #6
0
        public void GetStartPositionUnknown()
        {
            const Color color = (Color)5;

            Assert.Throws <IndexOutOfRangeException>(() => ColorPositions.StartPosition(color));
        }