【发布时间】:2015-09-21 05:02:09
【问题描述】:
所以我正在尝试 Microsoft Fakes,我喜欢它,但我有一个带有 out 参数的静态方法,我不知道如何使用它:
静态造假方法:
public static class Foo
{
public static bool TryBar(string str, out string stuff)
{
stuff = str;
return true;
}
}
测试:
[TestFixture]
public class MyTestTests
{
[Test]
public void MyTest()
{
using (ShimsContext.Create())
{
string output;
ShimFoo.TryBarStringStringOut = (input, out output) =>
{
output = "Yada yada yada";
return false;
};
}
}
}
现在我在测试中收到一个错误,声称我的输出参数错误(“无法解析符号'输出'”)。我一直在尝试获取有关如何处理参数的一些文档,但我找不到任何东西。有人有经验吗?
【问题讨论】:
标签: c# microsoft-fakes