public void TestCountBlueCardsInDeck() { IDeck deck = new Deck(); List<ICard> cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ColorCard == Color.BLUE) cards.Add(card); } Assert.IsTrue(cards.Count == 25); }
public void TestCardsInDeckNotNull() { IDeck deck = new Deck(); foreach (ICard card in deck.GetDeck()) { Assert.IsTrue(IsNotNullCard(card)); Assert.IsTrue(Enum.IsDefined(typeof(Color), card.ColorCard)); Assert.IsTrue(Enum.IsDefined(typeof(ValueCard), card.ValueCard)); } }
public void TestCountCardsInDeck_Value() { IDeck deck = new Deck(); List<ICard> cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.ZERO) cards.Add(card); } Assert.IsTrue(cards.Count == 4, "Кол-во карт 0 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.ONE) cards.Add(card); } Assert.IsTrue(cards.Count == 8, "Кол-во карт 1 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.TWO) cards.Add(card); } Assert.IsTrue(cards.Count == 8, "Кол-во карт 2 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.THREE) cards.Add(card); } Assert.IsTrue(cards.Count == 8, "Кол-во карт 3 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.FOUR) cards.Add(card); } Assert.IsTrue(cards.Count == 8, "Кол-во карт 4 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.FIVE) cards.Add(card); } Assert.IsTrue(cards.Count == 8, "Кол-во карт 5 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.SIX) cards.Add(card); } Assert.IsTrue(cards.Count == 8, "Кол-во карт 6 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.SEVEN) cards.Add(card); } Assert.IsTrue(cards.Count == 8, "Кол-во карт 7 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.EIGHT) cards.Add(card); } Assert.IsTrue(cards.Count == 8, "Кол-во карт 8 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.NINE) cards.Add(card); } Assert.IsTrue(cards.Count == 8, "Кол-во карт 9 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.MISS) cards.Add(card); } Assert.IsTrue(cards.Count == 8, "Кол-во карт пропуск хода в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.MOVEBACK) cards.Add(card); } Assert.IsTrue(cards.Count == 8, "Кол-во карт обратный ход в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.TAKETWO) cards.Add(card); } Assert.IsTrue(cards.Count == 8, "Кол-во карт возьми две в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.ORDERFLOWERS) cards.Add(card); } Assert.IsTrue(cards.Count == 4, "Кол-во карт выбери цвет в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.TAKEFOUR) cards.Add(card); } Assert.IsTrue(cards.Count == 4, "Кол-во карт возьми 4 в колоде: " + cards.Count.ToString()); }
public void TestCountCardsInDeck() { IDeck deck = new Deck(); Assert.IsTrue(deck.GetDeck().Count == 108, "Кол-во карт в колоде: " + deck.GetDeck().Count.ToString()); }
public void TestValueColorsCard() { IDeck deck = new Deck(); List<ICard> cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.ZERO && card.ColorCard == Color.BLUE) cards.Add(card); } Assert.IsTrue(cards.Count == 1, "Кол-во карт синий 0 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.ZERO && card.ColorCard == Color.GREEN) cards.Add(card); } Assert.IsTrue(cards.Count == 1, "Кол-во карт зеленый 0 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.ZERO && card.ColorCard == Color.RED) cards.Add(card); } Assert.IsTrue(cards.Count == 1, "Кол-во карт красный 0 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.ZERO && card.ColorCard == Color.YELLOW) cards.Add(card); } Assert.IsTrue(cards.Count == 1, "Кол-во карт желтый 0 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.ONE && card.ColorCard == Color.BLUE) cards.Add(card); } Assert.IsTrue(cards.Count == 2, "Кол-во карт синий 1 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.ONE && card.ColorCard == Color.YELLOW) cards.Add(card); } Assert.IsTrue(cards.Count == 2, "Кол-во карт желтый 1 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.ONE && card.ColorCard == Color.GREEN) cards.Add(card); } Assert.IsTrue(cards.Count == 2, "Кол-во карт зеленый 1 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.ONE && card.ColorCard == Color.RED) cards.Add(card); } Assert.IsTrue(cards.Count == 2, "Кол-во карт красный 1 в колоде: " + cards.Count.ToString()); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.TWO && card.ColorCard == Color.RED) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.TWO && card.ColorCard == Color.BLUE) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.TWO && card.ColorCard == Color.GREEN) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.TWO && card.ColorCard == Color.YELLOW) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.THREE && card.ColorCard == Color.YELLOW) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.THREE && card.ColorCard == Color.GREEN) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.THREE && card.ColorCard == Color.RED) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.THREE && card.ColorCard == Color.BLUE) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.FOUR && card.ColorCard == Color.YELLOW) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.FOUR && card.ColorCard == Color.GREEN) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.FOUR && card.ColorCard == Color.RED) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.FOUR && card.ColorCard == Color.BLUE) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.FIVE && card.ColorCard == Color.YELLOW) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.FIVE && card.ColorCard == Color.GREEN) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.FIVE && card.ColorCard == Color.RED) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.FIVE && card.ColorCard == Color.BLUE) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.SIX && card.ColorCard == Color.YELLOW) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.SIX && card.ColorCard == Color.GREEN) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.SIX && card.ColorCard == Color.RED) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.SIX && card.ColorCard == Color.BLUE) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.SEVEN && card.ColorCard == Color.YELLOW) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.SEVEN && card.ColorCard == Color.GREEN) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.SEVEN && card.ColorCard == Color.RED) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.SEVEN && card.ColorCard == Color.BLUE) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.EIGHT && card.ColorCard == Color.YELLOW) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.EIGHT && card.ColorCard == Color.GREEN) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.EIGHT && card.ColorCard == Color.RED) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.EIGHT && card.ColorCard == Color.BLUE) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.NINE && card.ColorCard == Color.YELLOW) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.NINE && card.ColorCard == Color.GREEN) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.NINE && card.ColorCard == Color.RED) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.NINE && card.ColorCard == Color.BLUE) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.MISS && card.ColorCard == Color.YELLOW) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.MISS && card.ColorCard == Color.GREEN) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.MISS && card.ColorCard == Color.RED) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.MISS && card.ColorCard == Color.BLUE) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.MOVEBACK && card.ColorCard == Color.YELLOW) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.MOVEBACK && card.ColorCard == Color.GREEN) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.MOVEBACK && card.ColorCard == Color.RED) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.MOVEBACK && card.ColorCard == Color.BLUE) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.TAKETWO && card.ColorCard == Color.YELLOW) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.TAKETWO && card.ColorCard == Color.GREEN) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.TAKETWO && card.ColorCard == Color.RED) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.TAKETWO && card.ColorCard == Color.BLUE) cards.Add(card); } Assert.IsTrue(cards.Count == 2); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.ORDERFLOWERS && card.ColorCard == Color.WILD) cards.Add(card); } Assert.IsTrue(cards.Count == 4); cards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ValueCard == ValueCard.TAKEFOUR && card.ColorCard == Color.WILD) cards.Add(card); } Assert.IsTrue(cards.Count == 4); }
public void TestRandomSortingDeck() { IDeck deck = new Deck(); List<IDeck> testListDecks = new List<IDeck>(); for (int i = 1; i <= 50; i++) { testListDecks.Add(deck.Sort()); } Assert.AreEqual(testListDecks.Count, 50); for (int i = 0; i < 50; i++) { for (int j = i+1; j < 50; j++) { IsNotEqualForGame(testListDecks[i], testListDecks[j]); } } }
public void TestCountWildCardsInDeck() { IDeck deck = new Deck(); List<ICard> wildCards = new List<ICard>(); foreach (ICard card in deck.GetDeck()) { if (card.ColorCard == Color.WILD) wildCards.Add(card); } Assert.IsTrue(wildCards.Count == 8, "Кол-во диких карт в колоде: " + wildCards.Count.ToString()); }