public static void AssertMatchesAreEqual(this ChronExMatches MatchList, string AssertedList) { if (MatchList == null) { throw new ArgumentNullException(nameof(MatchList)); } //if (string.IsNullOrWhiteSpace(AssertedList)) //{ // throw new ArgumentException("Asserted List", nameof(AssertedList)); //} var AssertAsList = AssertedList.Split(Environment.NewLine); if (MatchList.Count != AssertAsList.Count()) { throw new Exception($"Expected {AssertAsList.Count()} matches but Match list contained {MatchList.Count} \n{DescribeMatchList(MatchList)}"); } for (int i = 0; i < MatchList.Count(); i++) { MatchList[i].CapturedEvents.AssertMatchesAreEqual(AssertAsList[i]); } }
public static void AssertNoMatches(this ChronExMatches MatchList) { if (MatchList.Any()) { throw new Exception("No matches were expected but the following were found:" + DescribeMatchList(MatchList)); } }
private static string DescribeMatchList(ChronExMatches MatchList) { return(string.Join('\n', MatchList.Select(x => string.Join(",", x.CapturedEvents.Select(y => y.EventName))))); }