public void ReplaceNestedOperator() { var unaryOperator = new UnaryOperator(UnaryOperatorType.BitwiseNot, "pro"); CriteriaOperator criteriaOperator = new GroupOperator(new BinaryOperator(), unaryOperator); var binaryOperatorExtractor = new CriteriaOperatorExtractor(); var notOperator = new NotOperator(); binaryOperatorExtractor.Replace(ref criteriaOperator, unaryOperator.ToString(), notOperator); Assert.AreEqual(((GroupOperator) criteriaOperator).Operands[1], notOperator); }
public void ReplaceRootOperator() { CriteriaOperator unaryOperator = new UnaryOperator(UnaryOperatorType.IsNull, "prop2"); var binaryOperatorExtractor = new CriteriaOperatorExtractor(); var replaceOperator = new BinaryOperator("pr", 1); binaryOperatorExtractor.Replace(ref unaryOperator, unaryOperator.ToString(), replaceOperator); Assert.AreEqual(unaryOperator, replaceOperator); }