public void CompareCombinationsTest(string comb1, string comb2, int compRes) { var combination1 = new Combination(Helper.CreateCards(comb1)); var combination2 = new Combination(Helper.CreateCards(comb2)); Assert.AreEqual(compRes, combination1.CompareTo(combination2)); }
public int CompareTo(GameSeat other) { if (Combination == null) { return(-1); } return(Combination.CompareTo(other.Combination)); }
public void UnitCn_CompareTo() { Combination c0 = null; Combination c520 = new Combination(5, 2, 0); Combination c521 = new Combination(5, 2, 1); Combination c621 = new Combination(6, 2, 1); int actual1 = c520.CompareTo(c0); Assert.IsTrue(actual1 > 0); int actual2 = c520.CompareTo(c521); Assert.IsTrue(actual2 < 0); int actual3 = c521.CompareTo(c621); Assert.IsTrue(actual3 != 0); }
public int CompareHands(IHand firstHand, IHand secondHand) { if (!IsValidHand(firstHand) || !IsValidHand(secondHand)) { throw new ArgumentException( "One of the hands is invalid! You cannot compare invalid hands."); } Combination firstHandCombination = FindCombination(firstHand); Combination secondHandCombination = FindCombination(secondHand); int result = firstHandCombination.CompareTo(secondHandCombination); return(result); }