Esempio n. 1
0
        public void DeckOfCards_ShouldCreateDeck()
        {
            IDeckOfCards sut = new DeckOfCards();

            Assert.IsInstanceOf <IList <Card> >(sut.GetCards());
            Assert.AreEqual(sut.GetCards().Count, 52);
        }
Esempio n. 2
0
        public void SortDescending_ShouldBeListDescending()
        {
            IDeckOfCards sut = new DeckOfCards();

            sut.SortDescending();
            Assert.AreEqual(sut.GetCards()[0].GetRank().GetValue(), 13);
            Assert.AreEqual(sut.GetCards()[sut.GetCards().Count - 1].GetRank().GetValue(), 1);
        }
Esempio n. 3
0
        public void Shuffle_ShouldBeDeckOf52()
        {
            IDeckOfCards sut = new DeckOfCards();

            sut.Shuffle();
            Assert.NotNull(sut.GetCards());
            Assert.IsInstanceOf <List <Card> >(sut.GetCards());
            Assert.AreEqual(sut.GetCards().Count, 52);
        }
Esempio n. 4
0
        public void RemoveRandomCardsAsync_ShouldBeCardsRemovedFromDeck()
        {
            IDeckOfCards             sut             = new DeckOfCards();
            ValueTask <List <Card> > randomCardsTask = sut.RemoveRandomCardsAsync(5);
            List <Card> randomCards = randomCardsTask.Result;

            Assert.IsFalse(sut.GetCards().Contains(randomCards[0]));
            Assert.IsFalse(sut.GetCards().Contains(randomCards[1]));
            Assert.IsFalse(sut.GetCards().Contains(randomCards[2]));
            Assert.IsFalse(sut.GetCards().Contains(randomCards[3]));
            Assert.IsFalse(sut.GetCards().Contains(randomCards[4]));
        }
Esempio n. 5
0
        public void DeckOfCards_ShouldBeAceOfSpades()
        {
            List <Card> customDeck  = new List <Card>();
            CardName    cardName    = new CardName(ECardName.Ace);
            CardSuit    cardSuit    = new CardSuit(ECardSuit.Spades);
            Card        aceOfSpades = new Card(cardName, cardSuit);

            customDeck.Add(aceOfSpades);

            IDeckOfCards sut = new DeckOfCards(customDeck);

            Assert.IsInstanceOf <IList <Card> >(sut.GetCards());
            Assert.AreEqual(sut.GetCards().Count, 1);
            Assert.AreEqual(sut.GetCards()[0], aceOfSpades);
        }
Esempio n. 6
0
        public void AceUpTheSleeve_ShouldBeFiveAces()
        {
            DeckOfCards sut = new DeckOfCards();

            sut.AceUpTheSleeve();
            Assert.AreEqual(sut.GetCards().Count, 53);
            Assert.AreEqual(sut.GetAllCardsByCardName("Ace").Count, 5);
        }
Esempio n. 7
0
        public void AddCardsToDeckWithoutDuplicates_ShouldBe52Cards()
        {
            IDeckOfCards sut   = new DeckOfCards();
            IDeckOfCards deck2 = new DeckOfCards();

            sut.AddCardsToDeckWithoutDuplicates(deck2.GetCards());
            Assert.AreEqual(sut.GetCards().Count, 52);
        }
Esempio n. 8
0
        public void AddCardsToDeck_ShouldBe104Cards()
        {
            IDeckOfCards sut   = new DeckOfCards();
            IDeckOfCards deck2 = new DeckOfCards();

            sut.AddCardsToDeck(deck2.GetCards());
            Assert.AreEqual(sut.GetCards().Count, 104);
        }
Esempio n. 9
0
        public void AddCardToDeck_ShouldBe53Cards()
        {
            CardName cardName = new CardName(ECardName.Jack);
            CardSuit cardSuit = new CardSuit(ECardSuit.Diamonds);
            Card     card     = new Card(cardName, cardSuit);

            IDeckOfCards sut = new DeckOfCards();

            sut.AddCardToDeck(card);
            Assert.AreEqual(sut.GetCards().Count, 53);
        }
Esempio n. 10
0
    public void ShowCards()
    {
        int cardCount = 0;

        foreach (int i in deck.GetCards())
        {
            float co = cardOffset * cardCount;

            GameObject a;
            Vector3    temp = start = new Vector3(co, 0f);
            //a.transform.position = temp;
        }
    }
        public JsonResult AddDeck()
        {
            IDeckOfCards deck;

            if (Session[SESSION_DECK] == null)
            {
                deck = new DeckOfCards();
            }
            else
            {
                deck = (DeckOfCards)Session[SESSION_DECK];
                IDeckOfCards deckToAdd = new DeckOfCards();
                deck.AddCardsToDeck(deckToAdd.GetCards());
            }

            Session[SESSION_DECK] = deck; // Update deck in session
            return(Json(deck, JsonRequestBehavior.AllowGet));
        }
Esempio n. 12
0
        public void GetCards_ShouldBeListOfCards()
        {
            IDeckOfCards sut = new DeckOfCards();

            Assert.IsInstanceOf <IList <Card> >(sut.GetCards());
        }