Beispiel #1
0
        public void GetRulesForCustomer_RuleforSpecificCustomer_ReturnsSpecialRule()
        {
            // Arrange
            var customerRule = new List <CustomerRule> {
                new CustomerRule {
                    CustomerName = "UNILEVER", Rule = new Rule {
                        ProductName = "Classic Ads"
                    }
                },
                new CustomerRule {
                    CustomerName = "APPLE", Rule = new Rule {
                        ProductName = "Standout Ads"
                    }
                },
                new CustomerRule {
                    CustomerName = "NIKE", Rule = new Rule {
                        ProductName = "Premium Ads"
                    }
                },
            };
            // Act
            var result = RuleHelper.GetRulesForCustomer("UNILEVER", customerRule);

            // Assert
            Assert.AreEqual(2, result.Count);
        }
Beispiel #2
0
        public void GetRulesForCustomer_EmptyRule_ReturnsBasicRule()
        {
            // Arrange
            var customerRule = new List <CustomerRule> {
            };
            // Act
            var result = RuleHelper.GetRulesForCustomer("", customerRule);

            // Assert
            Assert.AreEqual(1, result.Count);
        }
Beispiel #3
0
 private static void CheckoutDefault(List <CustomerRule> fileRules)
 {
     Console.WriteLine("Total of Cart is : " + AdsCheckout.PerformCheckout(
                           new List <Product>
     {
         new ClassicAd(),
         new StandoutAd(),
         new PremiumAd()
     },
                           RuleHelper.GetRulesForCustomer("default", fileRules)
                           ));
 }
Beispiel #4
0
 private static void CheckoutNike(List <CustomerRule> fileRules)
 {
     Console.WriteLine("Total of cart is : " + AdsCheckout.PerformCheckout(
                           new List <Product>
     {
         new PremiumAd(),
         new PremiumAd(),
         new PremiumAd(),
         new PremiumAd()
     },
                           RuleHelper.GetRulesForCustomer("nike", fileRules)
                           ));
 }