Exemplo n.º 1
0
        public static async Task <ManyResult <T> > TryGetMany <T>(this IAcceptanceTestInfrastructureProvider provider, string url, Predicate <T> condition = null, string instanceName = Settings.DEFAULT_SERVICE_NAME) where T : class
        {
            if (condition == null)
            {
                condition = _ => true;
            }

            var response = await provider.GetInternal <List <T> >(url, instanceName).ConfigureAwait(false);

            if (response == null || !response.Any(m => condition(m)))
            {
                return(ManyResult <T> .Empty);
            }

            return(ManyResult <T> .New(true, response));
        }
Exemplo n.º 2
0
        protected async Task <ManyResult <T> > TryGetMany <T>(string url, Predicate <T> condition = null, string instanceName = Settings.DEFAULT_SERVICE_NAME) where T : class
        {
            if (condition == null)
            {
                condition = _ => true;
            }

            var response = await GetInternal <List <T> >(url, instanceName).ConfigureAwait(false);

            if (response == null || !response.Any(m => condition(m)))
            {
                await Task.Delay(1000).ConfigureAwait(false);

                return(ManyResult <T> .Empty);
            }

            return(ManyResult <T> .New(true, response));
        }