ReplaceMethodCallTransformer implements IMethodCallTransformer for the string.Replace(string,string) method.
Наследование: IMethodCallTransformer
 public void Transform_InvalidArgumentCount ()
 {
   var method = typeof (string).GetMethod ("ToUpper", new Type[] { });
   var objectExpression = Expression.Constant ("Test");
   var expression = Expression.Call (objectExpression, method);
   var transformer = new ReplaceMethodCallTransformer();
   transformer.Transform (expression);
 }
    public void Transform ()
    {
      var method = typeof (string).GetMethod ("Replace", new[] { typeof (string), typeof (string) });
      var objectExpression = Expression.Constant ("TAst");
      var expression = Expression.Call (objectExpression, method, Expression.Constant ("A"), Expression.Constant ("B"));
      var transformer = new ReplaceMethodCallTransformer();
      var result = transformer.Transform (expression);

      Assert.That (result, Is.InstanceOf (typeof (SqlFunctionExpression)));
      Assert.That (result.Type, Is.EqualTo (typeof (string)));
      Assert.That (((SqlFunctionExpression) result).SqlFunctioName, Is.EqualTo ("REPLACE"));
      Assert.That (((SqlFunctionExpression) result).Args[0], Is.EqualTo (objectExpression));
      Assert.That (((SqlFunctionExpression) result).Args.Count, Is.EqualTo (3));
    }