Beispiel #1
0
        public void ComparableSortsAbove()
        {
            var a = new CardType("V");
            var b = new CardType("M");

            Assert.AreEqual(1, a.CompareTo(b));
        }
Beispiel #2
0
        public void ComparableSortsBelow()
        {
            var a = new CardType("V");
            var b = new CardType("M");

            Assert.AreEqual(-1, b.CompareTo(a));
        }
Beispiel #3
0
 public int CompareTo(Card other)
 {
     if (type != other.type)
     {
         return(type.CompareTo(other.type));
     }
     return(rank.CompareTo(other.rank));
 }
 int IComparable <PickelCardGameCardInformation> .CompareTo(PickelCardGameCardInformation other)
 {
     if (CardType != other.CardType)
     {
         return(CardType.CompareTo(other.CardType));
     }
     if (Suit != other.Suit)
     {
         return(Suit.CompareTo(other.Suit));
     }
     return(Value.CompareTo(other.Value));
 }
 int IComparable <A8RoundRummyCardInformation> .CompareTo(A8RoundRummyCardInformation other)
 {
     if (CardType != other.CardType)
     {
         return(CardType.CompareTo(other.CardType));
     }
     if (Color != other.Color)
     {
         return(Color.CompareTo(other.Color));
     }
     if (Shape != other.Shape)
     {
         return(Shape.CompareTo(other.Shape));
     }
     return(Value.CompareTo(other.Value));
 }
Beispiel #6
0
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            Card otherCard = obj as Card;

            if (otherCard != null)
            {
                return(CardType.CompareTo(otherCard.CardType));
            }
            else
            {
                throw new ArgumentException("Object is not a Card");
            }
        }