public BooleanOperatorNode(LogicalOperatorKind kind = default(LogicalOperatorKind)) { if(kind == LogicalOperatorKind.Xor) throw new ArgumentException("Use XorOperatorNode to represent a XOR "); Kind = kind; }
public void Parse_Binary_Comparison_QuotedString_Success(string input, LogicalOperatorKind expectedLogicalOperatorKind, ComparisonKind expectedLeftComparisonKind, ComparisonKind expectedRightComparisonKind, string expectedLeftLeftString, string expectedLeftRightString, string expectedRightLeftString, string expectedRightRightString) { AssertParser.SucceedsWith(Parsers.Logical, input, actualLogical => { Assert.Equal(expectedLogicalOperatorKind, actualLogical.OperatorKind); // Left-hand comparison. Compare leftComparison = Assert.IsType <Compare>(actualLogical.Left); Assert.Equal(expectedLeftComparisonKind, leftComparison.ComparisonKind); QuotedString leftLeftString = Assert.IsType <QuotedString>(leftComparison.Left); Assert.Equal(expectedLeftLeftString, leftLeftString.StringContent); QuotedString leftRightString = Assert.IsType <QuotedString>(leftComparison.Right); Assert.Equal(expectedLeftRightString, leftRightString.StringContent); // Right-hand comparison. Compare rightComparison = Assert.IsType <Compare>(actualLogical.Right); Assert.Equal(expectedRightComparisonKind, rightComparison.ComparisonKind); QuotedString rightLeftString = Assert.IsType <QuotedString>(rightComparison.Left); Assert.Equal(expectedRightLeftString, rightLeftString.StringContent); QuotedString rightRightString = Assert.IsType <QuotedString>(rightComparison.Right); Assert.Equal(expectedRightRightString, rightRightString.StringContent); }); }
public BooleanOperatorNode(LogicalOperatorKind kind = default(LogicalOperatorKind)) { if (kind == LogicalOperatorKind.Xor) { throw new ArgumentException("Use XorOperatorNode to represent a XOR "); } Kind = kind; }
public BitOperatorNode(LogicalOperatorKind kind = default(LogicalOperatorKind)) { Kind = kind; }
public static FilterDefinition <T> HandleFilterDefinitions <T>(List <FilterDefinition <T> > filterDefinitions, LogicalOperatorKind operatorKind) { if (filterDefinitions == null) { throw new ArgumentNullException("filterDefinitions"); } if (!filterDefinitions.Any()) { return(Builders <T> .Filter.Empty); } if (filterDefinitions.Count == 1) { return(filterDefinitions[0]); } switch (operatorKind) { case LogicalOperatorKind.Or: { return(Builders <T> .Filter.Or(filterDefinitions)); } case LogicalOperatorKind.And: default: { return(Builders <T> .Filter.And(filterDefinitions)); } } }