Beispiel #1
0
        public async Task CheckAndPoliciesFirstFalseSecondTrue()
        {
            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(true);
            Policy legalPolicy1 = new Policy(rule1.Object);

            Policy andPolicy = legalPolicy1.And(rule2.Object);

            Assert.IsFalse(andPolicy.Check(shoppingBasket));
        }