I have been trying to resurrect an old .NET project that uses Rhino Mocks in its tests. I am referencing latest 3.6 version, but I seem to be missing a reference to extensions/helpers... or...?
I've added code similar to the following code - which comes from their "documentation" and is also referenced in numerous places. Problem is that "Stub" is not a method nor an extension method (won't compile with this message):
var stubUserRepository = MockRepository.GenerateStub<IUserRepository>();
var stubbedSmsSender = MockRepository.GenerateStub<ISmsSender>();
var theUser = new User{HashedPassword = "this is not hashed password"};
// following Stub method does not exist.
stubUserRepository.Stub(x => x.GetUserByName("ayende")).Return(theUser);
From looking at the return result T of MockRepository.GenerateStub, Stub must an extension method. What am I missing?
D'oh! I was fully qualifying other references to classes in Rhino.Mocks namespace - which ofcourse doesn't work well with the extension methods :-)
I was missing "using" statement.
using Rhino.Mocks // ... was missing
var foo = Rhino.Mocks.MockRepository.GenerateStub<IFoo>();
// following Stub method does not exist.
foo.Stub(x => x.bar())...
I hope this helps someone else.