/// <inheritdoc /> public async Task UpdateProductStockTo25(string merchantProductNo) { if (string.IsNullOrEmpty(merchantProductNo)) { throw new ArgumentNullException(nameof(merchantProductNo)); } var product = new LineResult { MerchantProductNo = merchantProductNo }; //Call to have up to date product var productsResult = await ProductsResult(new List <LineResult> { product }); var productToUpdate = productsResult?.Content?.FirstOrDefault() ?? throw new ApplicationException("Product not exist"); productToUpdate.Stock = 25; await _restClient.PostAsync <UpdateProductResult, UpdateProductRequest> ("products", new UpdateProductRequest { Products = new List <ProductResult> { productToUpdate } }); }
public void GenericRestClient_PostAsync_throw_exception_when_Configure_method_was_not_called_before() { //Act && Assert Assert.ThrowsAsync <InvalidOperationException>(async() => await _sut.PostAsync <string, object>("http://someUrl.com", new object())); }