示例#1
0
 public void ShuffleTest()
 {
     CardDeck a = new CardDeck(DeckInitType.StanderdAndNonShuffle);
     CardDeck b = new CardDeck(DeckInitType.StanderdAndNonShuffle);
     Assert.AreEqual(a.TakeTopCard(), b.TakeTopCard());
     a.Shuffle();
     Assert.AreNotEqual(a.TakeTopCard(), b.TakeTopCard());
 }
示例#2
0
 public void IsEmptyTest()
 {
     Card[] one = new Card[1];
     one[0] = new Card() { Suit = Suit.Spade, Rank = Rank.King };
     CardDeck a = new CardDeck(one);
     Assert.IsFalse(a.IsEmpty);
     a.TakeTopCard();
     Assert.IsTrue(a.IsEmpty);
 }
示例#3
0
 public void InitializeTest()
 {
     CardDeck a = new CardDeck();
     CardDeck b = new CardDeck(DeckInitType.OneJoker);
     CardDeck c = new CardDeck(DeckInitType.TwoJokers);
     CardDeck d = new CardDeck(DeckInitType.StanderdAndNonShuffle);
     Card[] one = new Card[1];
     one[0] = new Card() { Suit = Suit.Spade, Rank = Rank.King };
     CardDeck e = new CardDeck(one);
     Assert.AreEqual(a.Count, 52);
     Assert.AreNotEqual(a.Count, 53);
     Assert.AreEqual(b.Count, 53);
     Assert.AreEqual(c.Count, 54);
     Assert.AreEqual(d.Count, 52);
     Assert.AreEqual(e.Count, 1);
 }
示例#4
0
 public void TakeTopTest()
 {
     Card[] three = new Card[3];
     three[0] = new Card() { Suit = Suit.Heart, Rank = Rank.Ace };
     three[1] = new Card() { Suit = Suit.Heart, Rank = Rank.Two };
     three[2] = new Card() { Suit = Suit.Heart, Rank = Rank.Three };
     CardDeck a = new CardDeck(three);
     Assert.AreEqual(a.Count, 3);
     Assert.AreEqual(a.TakeTopCard(), three[0]);
     Assert.AreEqual(a.Count, 2);
     Assert.AreEqual(a.TakeTopCard(), three[1]);
     Assert.AreEqual(a.Count, 1);
     Assert.AreEqual(a.TakeTopCard(), three[2]);
     Assert.AreEqual(a.Count, 0);
     Assert.AreEqual(a.TakeTopCard(), null);
     Assert.AreEqual(a.Count, 0);
 }