public void ComparableSortsAbove() { var a = new CardType("V"); var b = new CardType("M"); Assert.AreEqual(1, a.CompareTo(b)); }
public void ComparableSortsBelow() { var a = new CardType("V"); var b = new CardType("M"); Assert.AreEqual(-1, b.CompareTo(a)); }
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)); }
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"); } }