【发布时间】:2011-11-28 10:26:33
【问题描述】:
我正在为某个方法创建一个单元测试,该方法加载由PluginAttribute 修饰的所有类型。
有没有办法在 Moles 生成的存根对象上“注入”一个属性,而不是手动创建存根并用 PluginAttribute 装饰它?
foreach (Type t in types)
{
var attr = Attribute.GetCustomAttribute(t, typeof(PluginAttribute), false) as PluginAttribute;
if (attr != null)
{
_checksLookup.Add(attr.ElementName, t);
}
}
}
【问题讨论】:
标签: moles