public void AtestCardStaticFunctions() { List <eCardId> allIds = new List <eCardId>((eCardId[])System.Enum.GetValues(typeof(eCardId))); allIds.Remove(eCardId.none); int i = 0; foreach (eCardId id in allIds) { ++i; eCardValue value = Card.GetValueOf(id); eCardFaction faction = Card.GetFactionOf(id); eCardId testId = Card.GetIdOf(value, faction); eCardColor color = Card.GetColorOf(id); Assert.That(id, Is.EqualTo(testId), "wanted id doesn't match faction and value"); if (faction == eCardFaction.club || faction == eCardFaction.spade) //pique ou trèfle { Assert.That(color, Is.EqualTo(eCardColor.black), "club or spade should be black"); } else if (faction == eCardFaction.diamond || faction == eCardFaction.heart) { Assert.That(color, Is.EqualTo(eCardColor.red), "diamond or heart should be red"); } else if (faction == eCardFaction.none) { Assert.That(color, Is.EqualTo(eCardColor.none), "\"none\" faction should be color \"none\""); } } Debug.Log(i + " cards tested"); Assert.That(i, Is.EqualTo(53), "wrong size of cardId"); }
private void TestCard(Card card, eCardId wantedId, string msg) { eCardValue value = Card.GetValueOf(wantedId); eCardColor color = Card.GetColorOf(wantedId); eCardFaction faction = Card.GetFactionOf(wantedId); Assert.That(card.cardId, Is.EqualTo(wantedId), msg); Assert.That(card.cardValue, Is.EqualTo(value), msg); Assert.That(card.color, Is.EqualTo(color), msg); Assert.That(card.faction, Is.EqualTo(faction), msg); }
public void ATestStaticList() { List <eCardId> std52 = Deck.GetDeckList(eDeckType.std52Card); List <eCardId> std54 = Deck.GetDeckList(eDeckType.std54Card); List <eCardId> std32 = Deck.GetDeckList(eDeckType.std32Card); Assert.That(std52.Count, Is.EqualTo(52)); Assert.That(std54.Count, Is.EqualTo(54)); Assert.That(std32.Count, Is.EqualTo(32)); Assert.That(std32.FindAll(x => x == eCardId.joker).Count, Is.EqualTo(0), "there is some jokers in 32card"); Assert.That(std32.FindAll(x => Card.GetValueOf(x) > eCardValue.six).Count, Is.EqualTo(32), "Some crad are inferior to seven"); Assert.That(std52.FindAll(x => x == eCardId.joker).Count, Is.EqualTo(0), "there is some jokers in 52card"); Assert.That(std54.FindAll(x => x == eCardId.joker).Count, Is.EqualTo(2), "there are less than two jokers in 54card"); }