public void EvaluateTerminalNodeFalse() { var exp = new RelationalExpression("Name", "Smith", RelationalOperator.Equal); var node = new FilterNode(exp); node.Evaluate(delegate { return(false); }); Assert.IsTrue(node.Evaluated.HasValue); Assert.IsFalse(node.Evaluated.Value); }
public void EvaluateTerminalNodeFalse() { RelationalExpression exp = new RelationalExpression("Name", "Smith", RelationalOperator.Equal); FilterNode node = new FilterNode(exp); node.Evaluate(delegate(FilterNode n) { return false; }); Assert.IsTrue(node.Evaluated.HasValue); Assert.IsFalse(node.Evaluated.Value); }
public void EvaluateTerminalNodeTrue() { RelationalExpression exp = new RelationalExpression("Name", "Smith", RelationalOperator.Equal); FilterNode node = new FilterNode(exp); node.Evaluate(delegate(FilterNode n) { return(true); }); Assert.IsTrue(node.Evaluated.HasValue); Assert.IsTrue(node.Evaluated.Value); }
public void EvaluateAndTreeTrueTrue() { var nodeLeft = new FilterNode(new TestFilterNode(true), new TestFilterNode(false), LogicalOperator.Or); var nodeRight = new FilterNode(new TestFilterNode(true), new TestFilterNode(true), LogicalOperator.And); var node = new FilterNode(nodeLeft, nodeRight, LogicalOperator.And); Assert.IsTrue(node.Evaluate(delegate(FilterNode n) { return(((TestFilterNode)n).Result); })); Assert.IsTrue(nodeLeft.Evaluated.HasValue); Assert.IsTrue(nodeLeft.Evaluated.Value); Assert.IsTrue(nodeRight.Evaluated.HasValue); Assert.IsTrue(nodeRight.Evaluated.Value); Assert.IsTrue(node.Evaluated.HasValue); Assert.IsTrue(node.Evaluated.Value); }
public void EvaluateOrNodeFalseFalse() { var expLeft = new RelationalExpression("Name", "Smith", RelationalOperator.Less); var expRight = new RelationalExpression("Name", "Smith", RelationalOperator.Greater); var nodeLeft = new FilterNode(expLeft); var nodeRight = new FilterNode(expRight); var node = new FilterNode(nodeLeft, nodeRight, LogicalOperator.Or); Assert.IsFalse(node.Evaluate(delegate { return(false); })); Assert.IsTrue(nodeLeft.Evaluated.HasValue); Assert.IsFalse(nodeLeft.Evaluated.Value); Assert.IsTrue(nodeRight.Evaluated.HasValue); Assert.IsFalse(nodeRight.Evaluated.Value); Assert.IsTrue(node.Evaluated.HasValue); Assert.IsFalse(node.Evaluated.Value); }
public void EvaluateAndNodeTrueTrue() { RelationalExpression expLeft = new RelationalExpression("Name", "Smith", RelationalOperator.Less); RelationalExpression expRight = new RelationalExpression("Name", "Smith", RelationalOperator.Greater); FilterNode nodeLeft = new FilterNode(expLeft); FilterNode nodeRight = new FilterNode(expRight); FilterNode node = new FilterNode(nodeLeft, nodeRight, LogicalOperator.And); Assert.IsTrue(node.Evaluate(delegate(FilterNode n) { return(true); })); Assert.IsTrue(nodeLeft.Evaluated.HasValue); Assert.IsTrue(nodeLeft.Evaluated.Value); Assert.IsTrue(nodeRight.Evaluated.HasValue); Assert.IsTrue(nodeRight.Evaluated.Value); Assert.IsTrue(node.Evaluated.HasValue); Assert.IsTrue(node.Evaluated.Value); }
public void EvaluateOrNodeFalseFalse() { RelationalExpression expLeft = new RelationalExpression("Name", "Smith", RelationalOperator.Less); RelationalExpression expRight = new RelationalExpression("Name", "Smith", RelationalOperator.Greater); FilterNode nodeLeft = new FilterNode(expLeft); FilterNode nodeRight = new FilterNode(expRight); FilterNode node = new FilterNode(nodeLeft, nodeRight, LogicalOperator.Or); Assert.IsFalse(node.Evaluate(delegate(FilterNode n) { return false; })); Assert.IsTrue(nodeLeft.Evaluated.HasValue); Assert.IsFalse(nodeLeft.Evaluated.Value); Assert.IsTrue(nodeRight.Evaluated.HasValue); Assert.IsFalse(nodeRight.Evaluated.Value); Assert.IsTrue(node.Evaluated.HasValue); Assert.IsFalse(node.Evaluated.Value); }
public void EvaluateAndTreeTrueTrue() { FilterNode nodeLeft = new FilterNode(new TestFilterNode(true), new TestFilterNode(false), LogicalOperator.Or); FilterNode nodeRight = new FilterNode(new TestFilterNode(true), new TestFilterNode(true), LogicalOperator.And); FilterNode node = new FilterNode(nodeLeft, nodeRight, LogicalOperator.And); Assert.IsTrue(node.Evaluate(delegate(FilterNode n) { return ((TestFilterNode)n).Result; })); Assert.IsTrue(nodeLeft.Evaluated.HasValue); Assert.IsTrue(nodeLeft.Evaluated.Value); Assert.IsTrue(nodeRight.Evaluated.HasValue); Assert.IsTrue(nodeRight.Evaluated.Value); Assert.IsTrue(node.Evaluated.HasValue); Assert.IsTrue(node.Evaluated.Value); }