Exemple #1
0
        private static TestCaseData ToNUnitCase(DistributePotTestCase handTestCase)
        {
            string name = "PokerSessionShouldDistributePotsCorrectly"
                          + "_" + (handTestCase.NameSuffix ?? "");

            return(new TestCaseData(handTestCase)
                   .SetName(name));
        }
Exemple #2
0
        public static void PokerSessionShouldDistributePotsCorrectly(DistributePotTestCase testCase)
        {
            var players = testCase.Players.Select(p => new Player
            {
                PlayerPot = testCase.PlayerPot,
                Cards     = CardParser.ParseCards(p.Cards).ToList(),
                Strategy  = p.Folds
                        ? (IPlayerStrategy) new FoldAlwaysStategy()
                        : new AllInStrategy()
            }).ToList();

            var session = new PokerSession(players);

            session.CheatCommunityCards(CardParser.ParseCards(testCase.CommunityCards).ToList());
            session.Simulate();

            CollectionAssert.AreEqual(
                expected: testCase.Players.Select(p => p.ExpectedPot).ToList(),
                actual: players.Select(p => p.PlayerPot)
                );
        }