public void calculate_hand_with_mix_of_aces_kings_queens_jacks(string hand, int expectedPoints) { BridgeHand bridgeHand = new BridgeHand(hand); int points = bridgeHand.CalculatePoints(); Assert.That(points, Is.EqualTo(expectedPoints)); }
public void suggest_opening_bid(string hand, string expectedBid) { BridgeHand bridgeHand = new BridgeHand(hand); var bid = bridgeHand.SuggestedOpeningBid(); Assert.That(bid, Is.EqualTo(expectedBid)); }
public void calculate_strongest_and_longest_suit(string hand, string suitLetter) { BridgeHand bridgeHand = new BridgeHand(hand); Suit strongestSuit = bridgeHand.CalculateStrongestLongestSuit(); Assert.That(strongestSuit.ToLetter(), Is.EqualTo(suitLetter)); }
public static string PredictFirstBid(BridgeHand Hand) { if (Hand.CountHandPoints() >= LowerLimItForOpeningBid && Hand.GetLengthOfLongestSuite() >= LengthOfSuiteToBid) { return(passBid); } return("1" + SuiteFactory.getSuitBuCommonName(LowestSuite)); }
public void calculate_points_by_suit_of_hearts(string hand, int expectedPoints) { BridgeHand bridgeHand = new BridgeHand(hand); Suit hearts = Suit.Hearts; int points = bridgeHand.CalculatePointsBy(hearts); Assert.That(points, Is.EqualTo(expectedPoints)); }
public void calculate_hand_with_no_points() { var hand = "S:????, H:???, D:??, C:????"; BridgeHand bridgeHand = new BridgeHand(hand); int points = bridgeHand.CalculatePoints(); Assert.That(points, Is.EqualTo(0)); }
/* * https://stackoverflow.com/questions/801070/dynamically-invoking-any-function-by-passing-function-name-as-string */ public static string PredictFirstBid(BridgeHand Hand, Conventions Convention) { object[] methodArgs = new object[1]; methodArgs[0] = Hand; object[] constructorArgs = new object[0]; string FactoryClassName = "WpfCAcademy.Factory." + Enum.GetName(typeof(Conventions), Convention) + "FirstBid"; var type = Type.GetType(FactoryClassName); object instance = Activator.CreateInstance(type, constructorArgs); MethodInfo method = type.GetMethod("PredictFirstBid"); object result = method.Invoke(instance, methodArgs); return(result.ToString()); }