Пример #1
0
 public void TrueTrueTest()
 {
     MockExpression leftExpression = new MockExpression(true);
     MockExpression rightExpression = new MockExpression(true);
     AndOperator expression = new AndOperator(leftExpression, rightExpression);
     Assert.IsTrue(expression.Evaluate(this.principal));
 }
 public void FalseFalseTest()
 {
     MockExpression leftExpression = new MockExpression(false);
     MockExpression rightExpression = new MockExpression(false);
     AndOperator expression = new AndOperator(leftExpression, rightExpression);
     Assert.IsFalse(expression.Evaluate(principal));
 }
Пример #3
0
        public void FalseTrueTest()
        {
            MockExpression leftExpression  = new MockExpression(false);
            MockExpression rightExpression = new MockExpression(true);
            AndOperator    expression      = new AndOperator(leftExpression, rightExpression);

            Assert.IsFalse(expression.Evaluate(this.principal));
        }
Пример #4
0
        public void ComplexExpressionTest()
        {
            AndOperator expression = new AndOperator();
            expression.Left = new RoleExpression("Managers");
            expression.Right = new NotOperator(new IdentityExpression("Bob"));

            GenericIdentity identity = new GenericIdentity("Bob");
            string[] roles = new string[] {"Managers"};
            GenericPrincipal principal = new GenericPrincipal(identity, roles);

            bool result = expression.Evaluate(principal);
            Assert.IsFalse(result);
        }
        public void ComplexExpressionTest()
        {
            AndOperator expression = new AndOperator();

            expression.Left  = new RoleExpression("Managers");
            expression.Right = new NotOperator(new IdentityExpression("Bob"));

            GenericIdentity identity = new GenericIdentity("Bob");

            string[]         roles     = new string[] { "Managers" };
            GenericPrincipal principal = new GenericPrincipal(identity, roles);

            bool result = expression.Evaluate(principal);

            Assert.IsFalse(result);
        }