【发布时间】:2013-12-02 21:20:27
【问题描述】:
1 -我在光盘上有这个文件内容(cs文件,未编译):
namespace Test
{
using System;
public class TestClass
{
public string SomeTestMethod(){
return "test here";
}
}
}
我如何在运行时把方法变成变量:
public string SomeTestMethod(){
return "test here";
}
例如:SourceCodeParser.GetMothod("path to file","SomeTestMethod");
2 - 可能是访问者成员的内容吗?
public string SomeMember {
get {
return "test here";
}
}
【问题讨论】:
-
您是在谈论为了测试目的而伪造实现吗?在这种情况下,请使用新的 Microsoft Fakes 框架,因为此类本身不可测试。
-
@MichaelPerrenoud - 谢谢,但没有。我想在 html 页面中显示该方法。