public void Escape_Expression() { var expression = Expression.Constant("test[test"); var result = SqlLikeExpression.Escape(expression, @"\"); var expectedResult = new SqlFunctionExpression(typeof(string), "REPLACE", new SqlFunctionExpression(typeof(string), "REPLACE", new SqlFunctionExpression(typeof(string), "REPLACE", new SqlFunctionExpression(typeof(string), "REPLACE", expression, new SqlLiteralExpression(@"\"), new SqlLiteralExpression(@"\\")), new SqlLiteralExpression("%"), new SqlLiteralExpression(@"\%")), new SqlLiteralExpression("_"), new SqlLiteralExpression(@"\_")), new SqlLiteralExpression("["), new SqlLiteralExpression(@"\[")); SqlExpressionTreeComparer.CheckAreEqualTrees(expectedResult, result); }
public void Escape_Bracket() { var result = SqlLikeExpression.Escape("test[test", @"\"); Assert.That(result, Is.EqualTo(@"test\[test")); }
public void Escape_Underline() { var result = SqlLikeExpression.Escape("test_test", @"\"); Assert.That(result, Is.EqualTo(@"test\_test")); }
public void Escape_EscapeSequence() { var result = SqlLikeExpression.Escape(@"test\test", @"\"); Assert.That(result, Is.EqualTo(@"test\\test")); }
public void Escape_Percent() { var result = SqlLikeExpression.Escape("test%test", @"\"); Assert.That(result, Is.EqualTo(@"test\%test")); }