Пример #1
0
        public void Calculate_rate_and_price_campaign_tests(decimal applePrice, decimal quantity, decimal discountRate, decimal discountPrice, decimal expectedValue)
        {
            IProductWithCampaignPriceAggregate productWithCampaignPriceAggregate = Resolve <IProductWithCampaignPriceAggregate>();

            ProductTransaction productTransaction = new ProductTransaction
            {
                Product = new Product
                {
                    Price     = applePrice,
                    Title     = "Apple",
                    Campaigns = new List <Campaign>
                    {
                        new Campaign
                        {
                            Discount = discountRate,
                            Type     = CampaignType.Rate,
                        },
                        new Campaign
                        {
                            Discount = discountPrice,
                            Type     = CampaignType.Price,
                        },
                    },
                },
                Quantity = quantity,
            };

            var actualPrice = productWithCampaignPriceAggregate.Calculate(productTransaction);

            Assert.Equal(expectedValue, actualPrice);
        }
 public CartTotalPriceAggregate(IProductWithCampaignPriceAggregate productTotalPriceAggregate)
 {
     _productTotalPriceAggregate = productTotalPriceAggregate;
 }