示例#1
0
        public void TestApplyRewards(decimal price, int quantity, decimal expectedTotalDiscount, PromotionReward[] rewards)
        {
            var currency = new Currency(Language.InvariantLanguage, "USD");
            var lineItem = new LineItem(currency, Language.InvariantLanguage)
            {
                ProductId = ExistingProductId
            };

            lineItem.ListPrice = new Money(price, currency);
            lineItem.SalePrice = lineItem.ListPrice;
            lineItem.Quantity  = quantity;
            lineItem.ApplyRewards(rewards);
            Assert.Equal(expectedTotalDiscount, lineItem.DiscountAmount.Amount);
        }