public void FlushRuleBigTest() { var rule = new FlushRule(); var builder = new RoundBuilder(new StringReader(testcase_bigflush)); var round = builder.Build(); var winners = rule.Apply(round); Assert.AreEqual(100000, winners.Count); }
public void FlushRuleTest() { var rule = new FlushRule(); const string testcase0 = "Player1 8H "; var builder = new RoundBuilder(new StringReader(testcase0)); var ex = Assert.ThrowsException <Exception>(() => builder.Build()); Assert.AreEqual(ex.Message, "Invalid player format"); const string testcase1 = "Player1 8H 7C 9D AH KC\r\nplayer2 7D 6C 5H QS 10H"; builder = new RoundBuilder(new StringReader(testcase1)); var winners = rule.Apply(builder.Build()); Assert.IsNotNull(winners); Assert.AreEqual(0, winners.Count); const string testcase2 = "Player1 8C 7C 9C AC KH\r\nplayer2 7C 6C 5C QC 10H"; builder = new RoundBuilder(new StringReader(testcase2)); winners = rule.Apply(builder.Build()); Assert.IsNotNull(winners); Assert.AreEqual(0, winners.Count); const string testcase3 = "Player1 8C 7C 9C AC KC\r\nPlayer2 7C 6C 5C QC 10H"; builder = new RoundBuilder(new StringReader(testcase3)); winners = rule.Apply(builder.Build()); Assert.IsNotNull(winners); Assert.AreEqual(1, winners.Count); Assert.AreEqual("Player1", winners[0].Name); const string testcase4 = "Player1 8C 7C 9C AC KC\r\nPlayer2 7C 6C 5C QC AC"; builder = new RoundBuilder(new StringReader(testcase4)); winners = rule.Apply(builder.Build()); Assert.IsNotNull(winners); Assert.AreEqual(1, winners.Count); Assert.AreEqual("Player1", winners[0].Name); const string testcase5 = "Player1 8C 7C 9C AC KC\r\nPlayer2 7C 6C 5C KC AC"; builder = new RoundBuilder(new StringReader(testcase5)); winners = rule.Apply(builder.Build()); Assert.IsNotNull(winners); Assert.AreEqual(1, winners.Count); Assert.AreEqual("Player1", winners[0].Name); const string testcase6 = "Player1 8C 7C 9C QC JC\r\nPlayer2 7C 6C 5C QC KC"; builder = new RoundBuilder(new StringReader(testcase6)); winners = rule.Apply(builder.Build()); Assert.IsNotNull(winners); Assert.AreEqual(1, winners.Count); Assert.AreEqual("Player2", winners[0].Name); const string testcase7 = "Player1 8C 7C 9C QC JC\r\nPlayer2 9C 8C 7C QC JC"; builder = new RoundBuilder(new StringReader(testcase7)); winners = rule.Apply(builder.Build()); Assert.IsNotNull(winners); Assert.AreEqual(2, winners.Count); Assert.AreEqual("Player1", winners[0].Name); Assert.AreEqual("Player2", winners[1].Name); const string testcase8 = "Player1 8C 7C 9C QC JC\r\nPlayer2 9C 8C 7C QC JC\r\nPlayer3 9C 8C 7C QC KC"; builder = new RoundBuilder(new StringReader(testcase8)); winners = rule.Apply(builder.Build()); Assert.IsNotNull(winners); Assert.AreEqual(1, winners.Count); Assert.AreEqual("Player3", winners[0].Name); }