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, eCardValue wantedValue, eCardFaction wantedfaction, string msg) { eCardId wantedId = Card.GetIdOf(wantedValue, wantedfaction); eCardColor color = Card.GetColorOf(wantedfaction); Assert.That(card.cardId, Is.EqualTo(wantedId), msg); Assert.That(card.cardValue, Is.EqualTo(wantedValue), msg); Assert.That(card.color, Is.EqualTo(color), msg); Assert.That(card.faction, Is.EqualTo(wantedfaction), msg); }