public async Task UpdateAsync() { var bundle = new SendOwlBundle { Name = TestBundleName + "[Update]", Price = "140.00", Components = new Components { Product_ids = new List <long> { ExistingProductIds.Value.First() } } }; var created = await endpoint.CreateAsync(bundle); await Task.Delay(5000); //API returns 500 if updating too fast after creation CreatedBundleIds.Add(created.Id); created.Price.ShouldBe(bundle.Price); created.Name.ShouldBe(bundle.Name); created.Price = "5.00"; created.Components.Product_ids.Add(ExistingProductIds.Value.Last()); var updated = await endpoint.UpdateAsync(created); updated.Price.ShouldBe(created.Price); updated.Components.Product_ids.OrderBy(p => p).ToList() .ShouldBe(created.Components.Product_ids.OrderBy(p => p).ToList()); }
public async Task CreateAsync() { var bundle = new SendOwlBundle { Name = TestBundleName, Price = "99.99", Components = new Components { Product_ids = ExistingProductIds.Value } }; var result = await endpoint.CreateAsync(bundle); CreatedBundleIds.Add(result.Id); result.Id.ShouldBeGreaterThan(1); result.Name.ShouldBe(bundle.Name); result.Price.ShouldBe(bundle.Price); result.Components.Product_ids.OrderBy(p => p).ToList() .ShouldBe(bundle.Components.Product_ids.OrderBy(p => p).ToList()); }