我的遗留(untestable)dll中有一个带参数参数的静态方法。我正在尝试为调用此方法的类编写单元测试。
public static class Branding
{
...
...
static public bool GetBranding(Int32 providerId,
Int32 employerId,
string brandingElement,
ref string brandingValue)
...
...
}
我需要帮助为此调用编写填充语句
ShimBranding.GetBrandingInt32Int32StringStringRef =
( providerId, employerId, element, { ====> WHAT GOES HERE <===== } )
=>
true;
谢谢!
答案 0 :(得分:16)
using (ShimsContext.Create())
{
ShimBranding.GetBrandingInt32Int32StringStringRef =
(int providerId, int employerId, string brandingElement, ref string brandingValue) =>
{
brandingValue = "Blah";
return true;
};
}