public static CardDTO GetCardDTO(Card card)
        {
            CardDTO dto = new CardDTO()
                          	{
                                    Number = card.Number,
                                    Symbol = (SymbolsDTO)((int)card.Symbol)
                          	};

            return dto;
        }
Esempio n. 2
0
        public void CreateObjectWithPropertiesSet_ObjectCreatedAndPropertiesSet()
        {
            Card card = new Card();
            Assert.AreEqual(0, card.Number);
            Assert.AreEqual(Symbols.CLUBS, card.Symbol);

            card = new Card(Symbols.HEARTS, 12);
            Assert.AreEqual(12, card.Number);
            Assert.AreEqual(Symbols.HEARTS, card.Symbol);
        }
Esempio n. 3
0
        public void IsCardGreater_DeterminesIfGreaterCardCheckWorks_Works()
        {
            Deck deck = GetDeck();

            Card card1 = new Card(Symbols.DIAMONDS, 5);
            Card card2 = new Card(Symbols.HEARTS, 5);

            Assert.AreEqual(null, deck.IsCardGreater(card1, card2));

            card2.Number = 6;

            Assert.AreEqual(false, deck.IsCardGreater(card1, card2));

            card1.Number = 13;
            Assert.AreEqual(true, deck.IsCardGreater(card1, card2));
        }
Esempio n. 4
0
        public bool IsCardGreater(Card card1, Card card2)
        {
            bool result = true;

            if (card1 != null)
            {
                if (card2 != null)
                {
                    if (card1.Number > card2.Number)
                    {
                        result = true;
                    }
                    else if (card1.Number < card2.Number)
                    {
                        result = false;
                    }
                }
                else
                {
                    throw new ArgumentNullException("Second Card parameter (card2) is null");
                }
            }
            else
            {
                throw new ArgumentNullException("First Card parameter (card1) is null");
            }

            return result;
        }