public async Task Able_to_load_json_resources() { var value = await _contentSet.GetAsJson <JsonStruct>("Content") .ConfigureAwait(false); value.ShouldNotBeNull(); }
public static IEnumerable <T> GetJsonAsList <T>(this IContentSet contentSet, string name, Func <T, bool>?predicate = null, JsonSerializerOptions?serializerOptions = null) { IEnumerable <T> value = contentSet.GetAsJson <IEnumerable <T> >(name, serializerOptions); if (predicate != null) { value = value.Where(predicate); } return(value); }
private static async Task <T> GetJsonAsListEntryInternal <T>(this IContentSet contentSet, string name, Func <T, bool> predicate, JsonSerializerOptions?serializerOptions = null) { IEnumerable <T> collection = await contentSet.GetAsJson <IEnumerable <T> >(name, serializerOptions) .ConfigureAwait(false); T result = collection.FirstOrDefault(predicate); return(result); }
public static T GetJsonAsListEntry <T>(this IContentSet contentSet, string name, Func <T, bool> predicate, JsonSerializerOptions?serializerOptions = null) { if (predicate is null) { throw new ArgumentNullException(nameof(predicate)); } IEnumerable <T> collection = contentSet.GetAsJson <IEnumerable <T> >(name, serializerOptions); T result = collection.FirstOrDefault(predicate); return(result); }