예제 #1
0
        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");
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
 public Card(eCardValue value, eCardColor color, eCardSide side = eCardSide.Front)
 {
     mValue       = value;
     mColor       = color;
     mVisibleSide = side;
 }