public override PromotionReward[] GetPromotionRewards()
 {
     var retVal = new CatalogItemReward
     {
         Amount = 100,
         AmountTypeId = (int)RewardAmountType.Gift,
         QuantityLimit = NumItem,
         SkuId = SelectedSkuId
     };
     return new PromotionReward[] { retVal };
 }
		public override PromotionReward[] GetPromotionRewards()
		{
			var retVal = new CatalogItemReward
			{
				Amount = Amount,
				QuantityLimit = NumItem,
				AmountTypeId = (int)RewardAmountType.Relative,
				ProductId = SelectedItemId,
				ExcludingSkus = String.Join(";", ExcludingSkuIds)
			};
			return new PromotionReward[] { retVal };
		}
		public override PromotionReward[] GetPromotionRewards()
		{
			var retVal = new CatalogItemReward
			{
				Amount = Amount,
				AmountTypeId = (int)RewardAmountType.Absolute,
				QuantityLimit = NumItem,
				ExcludingCategories = String.Join(";", ExcludingCategoryIds),
				ExcludingProducts = String.Join(";", ExcludingProductIds),
				ExcludingSkus = String.Join(";", ExcludingSkuIds)
			};
			return new PromotionReward[] { retVal };
		}
 public override PromotionReward[] GetPromotionRewards()
 {
     var retVal = new CatalogItemReward { Amount = Amount, AmountTypeId = (int)RewardAmountType.Relative };
     return new PromotionReward[] { retVal };
 }
		private PromotionReward AddCatalogReward(Promotion promotion, decimal amount, RewardAmountType amountType)
		{
			var promotionReward = new CatalogItemReward
			{
				Amount = amount,
				AmountTypeId = amountType.GetHashCode(),
				PromotionId = promotion.PromotionId
			};

			MarketingRepository.Add(promotionReward);
			MarketingRepository.UnitOfWork.Commit();

			return promotionReward;
		}
		public void Can_run_activity_removediscount()
		{
			var orderGroup = CreateCart();

			var promotionId = Guid.NewGuid().ToString();
			var lineItemSkuReward = orderGroup.OrderForms[0].LineItems[0];

			lineItemSkuReward.Discounts.Add(new LineItemDiscount()
				{
					DiscountAmount = 100, 
					PromotionId = promotionId, 
					DiscountCode = "code", 
					LineItemId = lineItemSkuReward.LineItemId
				});

			var reward = new CatalogItemReward
				{
					PromotionId = promotionId,
					Amount = 100,
					AmountTypeId = 2,
					SkuId = lineItemSkuReward.CatalogItemId,
					QuantityLimit = 1
				};

			var mockUnitOfWork = new Mock<IUnitOfWork>();
			var repository = new Mock<IMarketingRepository>();
			repository.Setup(x => x.PromotionRewards).Returns(() => new[] { reward }.AsQueryable());
			repository.Setup(x => x.UnitOfWork).Returns(mockUnitOfWork.Object);
			repository.SetupAllProperties();

			var activity = new RemoveDiscountActivity(repository.Object);

			InvokeActivity(activity, orderGroup);

			// now check if order contains any discounts
			var forms = from f in orderGroup.OrderForms select f;
			var orderForms = forms as OrderForm[] ?? forms.ToArray();
			Assert.True((from f in orderForms select f.Discounts.Count()).Sum() == 0, "still contains form discounts");

			Assert.False(forms.SelectMany(f=>f.LineItems).Any(x=>x.LineItemId == lineItemSkuReward.LineItemId), "still contains line item added as promotion reward");

			var shipments = from s in orderForms select s.Shipments;
			foreach (var shipmentCollection in shipments)
			{
				Assert.True((from s in shipmentCollection select s.Discounts.Count()).Sum() == 0, "still contains shipment discounts");
			}

			var lineitems = from s in orderForms select s.LineItems;
			foreach (var lineItemCollection in lineitems)
			{
				Assert.True((from s in lineItemCollection select s.Discounts.Count()).Sum() == 0, "still contains lineitem discounts");
			}
		}