public void Should_Create_Instance_Of_Card_When_Create_Card_Is_Called()
        {
            var card = _cardFactory.CreateCard(1234, 500);

            Assert.IsNotNull(card);
            Assert.IsInstanceOf <VirtualCashCard>(card);
        }
Example #2
0
        public void FixtureSetUp()
        {
            _cardFactory = new StandardCardFactory();

            _card1 = _cardFactory.CreateCard(10);
            _card2 = _cardFactory.CreateCard(20);
            _card3 = _cardFactory.CreateCard(30);
            _card4 = _cardFactory.CreateCard(10);
        }
Example #3
0
        public string AddCard(string type, string name)
        {
            ICard card = cardFactory.CreateCard(type, name);

            cardRepository.Add(card);
            return(string.Format(ConstantMessages.SuccessfullyAddedCard, type, name));
        }
        public string AddCard(string type, string name)
        {
            card = cardFactory.CreateCard(type, name);

            cardRepository.Add(card);
            return($"Successfully added card of type {type}Card with name: {name}");
        }
Example #5
0
        public string AddCard(string type, string name)
        {
            var newCard = cardFactory.CreateCard(type, name);

            cardRepo.Add(newCard);
            return(string.Format(ConstantMessages.SuccessfullyAddedCard, newCard.GetType().Name, newCard.Name));
        }
Example #6
0
        private void AddMultipleCardsToDeck()
        {
            Console.WriteLine(contants.AskToEnterDeckName);
            deckCollection.PrintNameOfAllDecks();
            string deckName = Console.ReadLine();

            Console.WriteLine("Please enter the name of the cards that you want to add:");
            Console.WriteLine("When done, please type exit ");

            while (true)
            {
                string cardToBeAdded = Console.ReadLine();

                if (cardToBeAdded == "exit")
                {
                    break;
                }
                foreach (ICard card in deckCollection.MyDeck[deckName].Cards)
                {
                    if (card.Name.ToLower() == cardToBeAdded)
                    {
                        Console.WriteLine("You already have this card in this deck.");
                        ManageDeckCollection();
                    }
                }
                deckCollection.MyDeck[deckName].Add(cardFactory.CreateCard(cardToBeAdded));
            }
        }
 public void FillDeck(IPokerDatabase database, ICardFactory cardFactory)
 {
     for (int cardPower = 2; cardPower <= 14; cardPower++)
     {
         foreach (CardType cardType in Enum.GetValues(typeof(CardType)))
         {
             database.AddCard(cardFactory.CreateCard(cardPower, cardType));
         }
     }
 }
Example #8
0
        public string AddCard(string type, string name)
        {
            var card = cardFactory.CreateCard(type, name);

            try
            {
                cards.Add(card);
            }
            catch (Exception e)
            {
                return(e.Message);
            }
            return(ConstantMessages.SuccessfullyAddedCard
                   .Replace("{0}", type)
                   .Replace("{1}", name));
        }
 public void FillDeck(IPokerDatabase database, ICardFactory cardFactory)
 {
     for (int cardPower = 2; cardPower <= 14; cardPower++)
     {
         foreach (CardType cardType in Enum.GetValues(typeof(CardType)))
         {
             database.AddCard(cardFactory.CreateCard(cardPower, cardType));
         }
     }
 }
Example #10
0
    Card CreateCard(CardFace face, GameObject prefab, ICardFactory factory)
    {
        Card card = factory.CreateCard(face, prefab);

        return(card);
    }
        public void Dealer_PowerSettingToPlayer_ShouldWork()
        {
            List <ICharacter> players = new List <ICharacter>();

            tableCards.Add(cardFactory.CreateCard(2, CardType.Diamonds));
            tableCards.Add(cardFactory.CreateCard(6, CardType.Spades));
            tableCards.Add(cardFactory.CreateCard(4, CardType.Spades));
            tableCards.Add(cardFactory.CreateCard(5, CardType.Clubs));
            tableCards.Add(cardFactory.CreateCard(5, CardType.Diamonds));

            player1.Hand.Add(cardFactory.CreateCard(5, CardType.Hearts));
            player1.Hand.Add(cardFactory.CreateCard(2, CardType.Hearts));

            player2.Hand.Add(cardFactory.CreateCard(5, CardType.Spades));
            player2.Hand.Add(cardFactory.CreateCard(9, CardType.Hearts));

            human.Hand.Add(cardFactory.CreateCard(11, CardType.Spades));
            human.Hand.Add(cardFactory.CreateCard(3, CardType.Hearts));

            player3.Hand.Add(cardFactory.CreateCard(7, CardType.Clubs));
            player3.Hand.Add(cardFactory.CreateCard(6, CardType.Clubs));

            player4.Hand.Add(cardFactory.CreateCard(11, CardType.Hearts));
            player4.Hand.Add(cardFactory.CreateCard(14, CardType.Hearts));

            player5.Hand.Add(cardFactory.CreateCard(8, CardType.Hearts));
            player5.Hand.Add(cardFactory.CreateCard(13, CardType.Diamonds));

            players.Add(player1);
            players.Add(player2);
            players.Add(human);
            players.Add(player3);
            players.Add(player4);
            players.Add(player5);

            dealer.CheckHandPower(player1, tableCards);
            dealer.CheckHandPower(player2, tableCards);
            dealer.CheckHandPower(human, tableCards);
            dealer.CheckHandPower(player3, tableCards);
            dealer.CheckHandPower(player4, tableCards);
            dealer.CheckHandPower(player5, tableCards);


            ICharacter winner = dealer.SetWinner(players, database);

            Assert.AreEqual(winner, player1);
        }
Example #12
0
 public void Initialize()
 {
     _cardFactory         = new CardFactory <VirtualCashCard>();
     _cardServiceProvider = new CardServiceProvider();
     _virtualCashCard     = _cardFactory.CreateCard(1234, 500);
 }