public async Task UpdateDealProduct() { var pipedrive = Helper.GetAuthenticatedClient(); var fixture = pipedrive.Deal; var createdDealProduct = await fixture.AddProductToDeal(1, new NewDealProduct(1, 10, 30)); var dealProductUpdate = new DealProductUpdate { ItemPrice = 44, Quantity = 1, Duration = 1, DiscountPercentage = 11 }; var updatedDealProduct = await fixture.UpdateDealProduct(1, createdDealProduct.ProductAttachmentId.Value, dealProductUpdate); Assert.Equal(1, updatedDealProduct.DealId); Assert.Equal(1, updatedDealProduct.ProductId); Assert.Equal(44, updatedDealProduct.ItemPrice); Assert.Equal(1, updatedDealProduct.Quantity); Assert.Equal(39.16m, updatedDealProduct.Sum); // Cleanup await fixture.DeleteDealProduct(1, createdDealProduct.ProductAttachmentId.Value); }
public void UpdateDealProduct() { var connection = Substitute.For <IApiConnection>(); var client = new DealsClient(connection); var dealProductUpdate = new DealProductUpdate(); client.UpdateDealProduct(1, 2, dealProductUpdate); connection.Received().Put <UpdatedDealProduct>(Arg.Is <Uri>(u => u.ToString() == "deals/1/products/2"), Arg.Is(dealProductUpdate)); }