예제 #1
0
        public void DefaultPriceAppliedWhenOtherNonApplicationRulesArePresentTest()
        {
            var priceBuilder = new PriceRuleBuilder().AddDefaultPriceRule("33333", 20.99m).AddContractPrice("11111", 12.99m, "111111");
            var engine       = new Engine(priceBuilder.Rules);
            var itemBuilder  = new ItemBuilder().AddItem("33333", 3.99m, 1m);

            var actual = engine.ApplyRules(itemBuilder.Items, _customer.Object);

            Assert.AreEqual(1, actual.Count());
            Assert.AreEqual(5.19m, actual.First().Price);
        }
예제 #2
0
        public void SimpleDefaultPriceTest()
        {
            var priceBuilder = new PriceRuleBuilder().AddDefaultPriceRule("33333", 20.99m);
            var engine       = new Engine(priceBuilder.Rules);
            var itemBuilder  = new ItemBuilder().AddItem("33333", 3.99m, 1);

            var actual = engine.ApplyRules(itemBuilder.Items, _customer.Object);

            Assert.AreEqual(1, actual.Count());
            Assert.AreEqual(5.19m, actual.First().Price);
        }