Esempio n. 1
0
        public void GetOutOfJailFreeCardsAreRemoved()
        {
            var cardManager  = new CardManager(new Board(new AssetManager()));
            var cardsRemoved = 0;

            var chanceCount         = cardManager.ChanceDeck.Count;
            var communityChestCount = cardManager.CommunityChestDeck.Count;

            for (int i = 0; i < cardManager.ChanceDeck.Count; i++)
            {
                var card = cardManager.GetNextChance();

                if (card is SpecialCard)
                {
                    if (((SpecialCard)card).CardType == SpecialCardType.GetOutOfJailFreeChance)
                    {
                        cardsRemoved++;
                    }
                }
            }

            for (int i = 0; i < cardManager.CommunityChestDeck.Count; i++)
            {
                var card = cardManager.GetNextCommunityChest();

                if (card is SpecialCard)
                {
                    if (((SpecialCard)card).CardType == SpecialCardType.GetOutOfJailFreeCommunityChest)
                    {
                        cardsRemoved++;
                    }
                }
            }

            Assert.AreEqual(2, cardsRemoved);
            Assert.AreEqual(2, cardsRemoved);

            Assert.AreEqual(chanceCount - 1, cardManager.ChanceDeck.Count);
            Assert.AreEqual(communityChestCount - 1, cardManager.CommunityChestDeck.Count);
        }
Esempio n. 2
0
        private void LandedOnSpecialSquare(Player player)
        {
            var specialSquare = (SpecialSquare)player.Location;

            switch (specialSquare.SpecialSquareType)
            {
            case SpecialSquare.SquareType.Go:
                break;

            case SpecialSquare.SquareType.Jail:
                break;

            case SpecialSquare.SquareType.FreeParking:
                FreeParking.Pay(FreeParking.Money, player, Bank);
                break;

            case SpecialSquare.SquareType.CommunityChest:
                ProcessCard(player, CardManager.GetNextCommunityChest());
                break;

            case SpecialSquare.SquareType.Chance:
                ProcessCard(player, CardManager.GetNextChance());
                break;

            case SpecialSquare.SquareType.GoToJail:
                SendToJail(player);
                break;

            case SpecialSquare.SquareType.IncomeTax:
                player.Pay(200, FreeParking, Bank);
                break;

            case SpecialSquare.SquareType.SuperTax:
                player.Pay(100, FreeParking, Bank);
                break;

            default:
                break;
            }
        }