Ejemplo n.º 1
0
        public async Task CheckConditionPoliciesFirstFalseSecondFalse()
        {
            await this.shoppingBasket.addProduct(product1, 1);

            await this.shoppingBasket.addProduct(product2, 2);

            Mock <IRule> rule1 = new Mock <IRule>();

            rule1.Setup(r => r.Check(It.IsAny <ShoppingBasket>())).Returns(false);
            Mock <IRule> rule2 = new Mock <IRule>();

            rule2.Setup(r => r.Check(It.IsAny <ShoppingBasket>())).Returns(false);
            Policy legalPolicy1 = new Policy(rule1.Object);

            Policy conditionPolicy = legalPolicy1.Condition(rule2.Object);

            Assert.IsTrue(conditionPolicy.Check(shoppingBasket));
        }