初次使用NMock2,报个小错

Posted on 2008-12-22 15:20  NewComer  阅读(354)  评论(0编辑  收藏  举报

xxxxxx.xxxxx.xxxx:
System.TypeLoadException : Could not load type 'MultiInterface1' from assembly 'Mocks, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' because it attempts to implement a class as an interface.

 

具体原因:NMock2 only support mocking interface but not class. If you try to mock class, you will get an error message: System.TypeLoadException: Could not load type 'MultiInterface1' from assembly ......

 

翻译过来就是:要用NMock2,被Mock的东东就必须是Interface,而不能直接是Class