Ejemplo n.º 1
0
        public async Task Able_to_load_json_resources()
        {
            var value = await _contentSet.GetAsJsonAsync <JsonStruct>("Content")
                        .ConfigureAwait(false);

            value.ShouldNotBeNull();
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }