public async Task <bool> PostAsync(string urlExtension, TEntity model, string token = null) { _loggerWrapper.LogInformation(nameof(urlExtension) + ": " + urlExtension + " | " + nameof(model) + ": " + "cannot display" + " | " + nameof(token) + ": " + token, this.GetType().Name, nameof(PostAsync) + "()", null); return(await CheckExceptions(async() => (await _httwrap.PostAsync(urlExtension, model, null, token != null ? GetCustomHeaders(token) : null)) .Success)); }
public async void Delete_test() { var product = FixtureRepository.Build <Product>().Without(p => p.Id).Create(); await _client.PostAsync("api/products", product); var response = await _client.DeleteAsync("api/products/1"); response.Should().NotBeNull(); response.StatusCode.Should().Be(HttpStatusCode.NoContent); }
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); }
protected async Task <IHttwrapResponse> PostAsync(string urlExtension, TEntity model, string token = null) => await CheckExceptions(async() => await _httwrapClient.PostAsync(urlExtension, model, null, token != null ? GetCustomHeaders(token) : null));