Example #1
0
        public static async Task AssertContentJsonManyAsync(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
                {
                    await testCaseContext.AssertContentAsync(item, path);
                }
                catch (Exception e)
                {
                    exceptions.Add(e);
                }
            }

            if (exceptions.Count > 0)
            {
                throw new AggregateException(exceptions);
            }
        }
Example #2
0
 public static Task AssertContentAsync(this TestCaseContext testCaseContext, JToken item, string path)
 => testCaseContext.AssertContentAsync(item.ToIndentedJson(), path);
Example #3
0
 public static Task AssertContentJsonAsync(this TestCaseContext testCaseContext, string content, string path)
 => testCaseContext.AssertContentAsync(JsonConvert.DeserializeObject <JToken>(content), path);