public static void AssertContentJsonMany(this TestCaseContext testCaseContext, string content, string dir, Func <JToken, string> itemNameFunc) { var exceptions = new List <Exception>(); //TODO check all is present var items = JsonConvert.DeserializeObject <IEnumerable <JToken> >(content); foreach (var item in items) { var path = Path.Combine(dir, itemNameFunc(item)); try { testCaseContext.AssertContent(item, path); } catch (Exception e) { exceptions.Add(e); } } if (exceptions.Count > 0) { throw new AggregateException(exceptions); } }
public static void AssertContentJson(this TestCaseContext testCaseContext, string content, string path) { testCaseContext.AssertContent(JsonConvert.DeserializeObject <JToken>(content), path); }
public static void AssertContent(this TestCaseContext testCaseContext, JToken item, string path) { testCaseContext.AssertContent(item.ToIndentedJson(), path); }