public static void AssertExceptionsEqual(this IContractResolver contractResolver, IEnumerable <Exception> expected, IEnumerable <JToken> actual) { // Validate parameters. if (contractResolver == null) { throw new ArgumentNullException(nameof(contractResolver)); } if (expected == null) { throw new ArgumentNullException(nameof(expected)); } if (actual == null) { throw new ArgumentNullException(nameof(actual)); } // Cycle through the exceptions, compare to actual. Zip. foreach (var pair in expected.ZipChecked(actual, (f, s) => new { Exception = f, JToken = s })) { // Assert. contractResolver.AssertExceptionsEqual(pair.Exception, pair.JToken); } }