我无法设置 Spring.Net 的配置,以便可以使用 Rhino Mocks 生成模拟对象。我意识到 GenerateMock 是一个静态方法,所以我需要在配置中使用工厂方法,但我无法让它工作。这是我正在使用的配置:
<object id="exampleObject"
type="Rhino.Mocks.MockRepository, Rhino.Mocks"
factory-method="GenerateMock&lt;MyAssembly.MyInterface>" />
然后在我的代码(这是一个单元测试)中我使用:
using (IApplicationContext ctx = ContextRegistry.GetContext()) {....}
但我收到以下错误消息:
System.Configuration.ConfigurationErrorsException: Error creating context 'spring.root': Could not load type from string value 'MyAssembly.MyInterface'. ---> System.TypeLoadException: Could not load type from string value 'MyAssembly.MyInterface'..
任何想法为什么我可能会收到错误?