private HandHistory ParseHandHistory(string handHistoryFile) { var parser = new PokerStarsFastParserImpl(); var handHistoryText = File.ReadAllText(handHistoryFile); var hands = parser.SplitUpMultipleHands(handHistoryText).ToArray(); var hand = hands.Single(); var handHistory = parser.ParseFullHandHistory(hand, true); return(handHistory); }
public void ParsingDoesNotThrowExceptions(string culture) { var cultureInfo = new CultureInfo(culture); Thread.CurrentThread.CurrentCulture = cultureInfo; var testDataDirectoryInfo = new DirectoryInfo(TestDataFolder); var handHistoryFiles = testDataDirectoryInfo.GetFiles("*.txt", SearchOption.AllDirectories); var parser = new PokerStarsFastParserImpl(); var succeded = 0; var total = 0; foreach (var handHistoryFile in handHistoryFiles) { var handHistory = File.ReadAllText(handHistoryFile.FullName); var hands = parser.SplitUpMultipleHands(handHistory).ToArray(); total += hands.Length; var hash = new HashSet <string>(); foreach (var hand in hands) { try { parser.ParseFullHandHistory(hand, true); succeded++; } catch (Exception e) { if (!hash.Contains(handHistoryFile.FullName)) { Debug.WriteLine(handHistoryFile.FullName); } Assert.Fail(e.ToString()); } } } Assert.AreEqual(total, succeded); Debug.WriteLine("Processed hands: {0}/{1}", succeded, total); }