Linux 3.2.0-3-amd64 #1 SMP Mon Jul 23 02:45:17 UTC 2012 x86_64 GNU/Linux
Mono 2.10.8.1 (Debian 2.10.8.1-7) (64-bit)
glib-sharp 2.12.0.0
FitNesse (v20121220)
FitSharp release 2.2 for .net 4.0
我有一个 C# 夹具,其中包含以下通用方法
public Func<T> GetProcedure<T>(string name)
{
return () => default(T);
}
问题:如何从 Slim 脚本表中调用GetProcedure ?
| show | GetProcedure; <?specify type here?> | text |
我在源码中发现了如下测试,所以应该是可以的。但是,我不知道如何在脚本表中定义类型 T 以便 slim 可以解析它... https://github.com/jediwhale/fitsharp/blob/master/source/fitSharpTest/NUnit/Machine/ MemberQueryTest.cs
[Test] public void GenericMethodWithParmsIsInvoked() {
var member = new MemberName("genericmethodofsystemint32", "genericmethod", new[] { typeof(int)});
var method = MemberQuery.FindInstance(MemberQuery.FindMember, instance, new MemberSpecification(member, 1));
Assert.IsNotNull(method);
var result = method.Invoke(new object[] {123});
Assert.AreEqual("sample123", result.Value.ToString());
}
// This method found via the reflection above.
// see: fitSharp.Test.Double.SampleClass
public string GenericMethod<T>(T input) {
return "sample" + input;
}