public async Task Able_to_load_json_resources() { var value = await _contentSet.GetAsJsonAsync <JsonStruct>("Content") .ConfigureAwait(false); value.ShouldNotBeNull(); }
private static async Task <T> GetJsonAsListEntryAsyncInternal <T>(this IContentSet contentSet, string name, Func <T, bool> predicate, JsonSerializerOptions?serializerOptions = null) { IEnumerable <T> collection = await contentSet.GetAsJsonAsync <IEnumerable <T> >(name, serializerOptions) .ConfigureAwait(false); T result = collection.FirstOrDefault(predicate); return(result); }
public static async Task <IEnumerable <T> > GetJsonAsListAsync <T>(this IContentSet contentSet, string name, Func <T, bool>?predicate = null, JsonSerializerOptions?serializerOptions = null) { IEnumerable <T> value = await contentSet.GetAsJsonAsync <IEnumerable <T> >(name, serializerOptions) .ConfigureAwait(false); if (predicate != null) { value = value.Where(predicate); } return(value); }