public void Subscription_Can_EditProduct_NoDelay() { // Arrange var subscription = Chargify.GetSubscriptionList().FirstOrDefault(s => s.Value.State == SubscriptionState.Active && s.Value.PaymentProfile != null).Value as Subscription; var otherProduct = Chargify.GetProductList().Values.Where(p => p.Handle != subscription.Product.Handle).FirstOrDefault(); // Act var result = Chargify.EditSubscriptionProduct(subscription.SubscriptionID, otherProduct.Handle); // Assert Assert.IsNotNull(result); Assert.AreEqual(otherProduct.Handle, result.Product.Handle); }
public void Subscription_Can_Cancel_Delayed_Product_Change() { // Arrange var subscription = Chargify.GetSubscriptionList().FirstOrDefault(s => s.Value.State == SubscriptionState.Active && s.Value.PaymentProfile != null && s.Value.NextProductId <= 0).Value; var otherProduct = Chargify.GetProductList().FirstOrDefault(p => p.Key != subscription.Product.ID); var updatedSubscription = Chargify.EditSubscriptionProduct(subscription.SubscriptionID, otherProduct.Value.Handle, true); Assert.AreEqual(otherProduct.Key, updatedSubscription.NextProductId); // Act var result = Chargify.CancelDelayedProductChange(updatedSubscription.SubscriptionID); // Assert Assert.IsNotNull(result); Assert.IsTrue(result.NextProductId <= 0); }