How to mock IDbSet with Rhino Mocks
问题 I can't get this working at all. I've got this code in my test: MockRepository repository = new MockRepository(); IDbSet<SystemUser> userSet = repository.StrictMock<IDbSet<SystemUser>>(); Expect.Call(userSet.Any(u => u.Id == "UserName")).Return(true); // More code follows But it bombs out on the StrictMock line with the error: System.TypeLoadException: Method 'Create' on type 'IDbSet`1Proxy1862178487664986a7bd03ad3b5c6f2c' from assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture