public GroceryItemRule GetPricingRule(string ruleText)
        {
            GroceryItemRule rule;

            if (ruleText.Contains("get")) //covers get one for
                rule = new BuyOneGetOneRule(ruleText);
            else if (ruleText.Contains("for")) //covers for $2.00
                rule = new GroupRule(ruleText);
            else
                rule = new PercentOffRule(ruleText);

            return rule;
        }
        public void TestingTwoFreeRule()
        {
            const string rule = "buy two get one free";

            const int expected = 1;

            var gRule = new BuyOneGetOneRule(rule);
            var saved = gRule.ProcessAmountSaved(4, 1);

            Assert.AreEqual(expected, saved);
        }
        public void TestingTotalRule()
        {
            const string rule = "buy one get one for $2.00";

            const int expected = 2;

            var gRule = new BuyOneGetOneRule(rule);
            var saved = gRule.ProcessAmountSaved(5, 3);

            Assert.AreEqual(expected, saved);
        }
        public void TestingPercentRule()
        {
            const string rule = "buy one get one 50% off";

            const decimal expected = (decimal) 0.50;

            var gRule = new BuyOneGetOneRule(rule);
            var saved = gRule.ProcessAmountSaved(3, 1);

            Assert.AreEqual(expected, saved);
        }