public void InstanceConvertOverloaded() { var expr = new CallConverterExpression { Source = Source, Path = $"{nameof(Foo.Sub)}.{nameof(Foo.InstanceConvertOverloaded)}", }; expr.GetValue(Source).As <ConverterFunc>().Invoke(1, 2m, Culture).Should().Be("B-1-2m"); expr.GetValue(Source).As <ConverterFunc>().Invoke(1, 2f, Culture).Should().Be("B-1-2f"); }
public void ConvertSource() { var expr = new CallConverterExpression { Source = new Func <object, object>(v => Source.InstanceConvert1((int)v)), }; expr.GetValue(Source).As <ConverterFunc>().Invoke(1, 2, Culture).Should().Be("A-1"); }
public void StaticConvert(string methodName, string result) { var expr = new CallConverterExpression { Source = Source, Path = $"{nameof(Foo.Sub)}.{methodName}", }; expr.GetValue(Source).As <ConverterFunc>().Invoke(1, 2, Culture).Should().Be(result); }