public async Task <List <TEntity> > GetAllAsync(string urlExtension, string token = null) { _loggerWrapper.LogInformation(nameof(urlExtension) + ": " + urlExtension + " | " + nameof(token) + ": " + token, this.GetType().Name, nameof(GetAllAsync) + "()", null); return(await CheckExceptions(async() => (await _httwrap.GetAsync(urlExtension, null, token != null ? GetCustomHeaders(token) : null)) .ReadAs <List <TEntity> >())); }
public async void Get_All_test() { Product product = FixtureRepository.Build <Product>().Without(p => p.Id).Create(); await _client.PostAsync("api/products", product); IHttwrapResponse <IEnumerable <Product> > response = await _client.GetAsync <IEnumerable <Product> >("api/products"); response.Data.Should().NotBeNullOrEmpty(); response.Data.Count().Should().Be(1); }
private async Task ClearApiCache() { var clearResponse = await _client.GetAsync("api/products?op=clear"); clearResponse.StatusCode.Should().Be(HttpStatusCode.OK); }
protected async Task <IHttwrapResponse> GetAllAsync(string urlExtension, string token = null) => await CheckExceptions(async() => await _httwrapClient.GetAsync(urlExtension, null, token != null ? GetCustomHeaders(token) : null));
public async Task <List <WriterResponse> > GetWriters() { IHttwrapResponse response = await _httwrapClient.GetAsync("writers"); return(response.ReadAs <List <WriterResponse> >()); }
public async Task <List <ArticleResponse> > GetArticles() { IHttwrapResponse response = await _httwrapClient.GetAsync("articles"); return(response.ReadAs <List <ArticleResponse> >()); }