示例#1
0
        public void RulesTests_DebitCardAccountRule_PassesFor_GoldBundle()
        {
            var bundle = new GoldBundle().GetDefault;

            var rule = new DebitCardAccountRule();

            var result = rule.Execute(bundle);

            Assert.IsTrue(result);
        }
示例#2
0
        public void RulesTests_DebitCardAccountRule_HandlesNoAccount()
        {
            var bundle = new GoldBundle().GetDefault;

            bundle.Products = new List <Product>();

            var rule = new DebitCardAccountRule();

            var result = rule.Execute(bundle);

            Assert.IsFalse(result);
        }
示例#3
0
        public void RulesTests_DebitCardAccountRule_PassesFor_GoldBundleWithPensionerAccount()
        {
            var bundle = new GoldBundle().GetDefault;

            bundle.Products = new List <Product> {
                new PensionerAccount()
            };

            var rule = new DebitCardAccountRule();

            var result = rule.Execute(bundle);

            Assert.IsTrue(result);
        }
示例#4
0
        public void ProductBundleService_GetsAnswersFor_GoldBundle()
        {
            var bundle  = new GoldBundle();
            var answers = _productBundleService.GetRulesConditions(bundle);

            var expectedAnswers = new[]
            {
                "Age > 17",
                "Income > 40000"
            };

            Assert.IsTrue(answers.Length == expectedAnswers.Length);
            Assert.IsTrue(answers.All(expectedAnswers.Contains));
        }