public async Task <ActionResult> CreateProduct(ProductViewModel model) { var response = await productClient.CreateProduct(model); if (response.StatusIsSuccessful) { var productId = response.Data; return(RedirectToAction("GetProduct", new { id = productId })); } AddResponseErrorsToModelState(response); return(View(model)); }
public async Task CreateProductTest() { // Arrange var args = new ProductCreateArguments(); _stripe.Post( Arg.Is <StripeRequest <ProductCreateArguments, Product> >(a => a.UrlPath == "products" && a.Model == args), _cancellationToken).Returns(Task.FromResult(new StripeResponse <Product>())); // Act var response = await _client.CreateProduct(args, _cancellationToken); // Assert response.Should().NotBeNull(); }