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)); }
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)); }
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); }