本文整理汇总了C#中MerchantTribe.Commerce.Orders.Order.RemoveCouponCode方法的典型用法代码示例。如果您正苦于以下问题:C# Order.RemoveCouponCode方法的具体用法?C# Order.RemoveCouponCode怎么用?C# Order.RemoveCouponCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MerchantTribe.Commerce.Orders.Order
的用法示例。
在下文中一共展示了Order.RemoveCouponCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveCouponCodeTest
public void RemoveCouponCodeTest()
{
Order target = new Order();
RequestContext c = new RequestContext();
c.CurrentStore = new Accounts.Store() { Id = 1 };
OrderRepository repository = OrderRepository.InstantiateForMemory(c);
repository.Create(target);
target.AddCouponCode("one");
target.AddCouponCode("two");
target.AddCouponCode("three");
repository.Update(target);
Assert.IsTrue(target.RemoveCouponCode(target.Coupons[1].Id), "Call to remove failed");
Assert.AreEqual(2, target.Coupons.Count, "Target count should be two!");
Assert.IsTrue(repository.Update(target), "Call to updated failed");
Order actual = repository.FindForCurrentStore(target.bvin);
Assert.AreEqual(2, actual.Coupons.Count, "Coupon count didn't match");
for (int i = 0; i < target.Coupons.Count; i++)
{
Assert.AreEqual(target.Coupons[i].CouponCode, actual.Coupons[i].CouponCode, "Code didn't match for index " + i);
}
}