Why doesn't a mock or stub have default constructor?
I create a mock:
IProfileRepository mockProfileRepository =
mocks.StrictMock<IProfileRepository>();
and then swap in my service locator class:
serviceLocator.Register<IProfileRepository>(mockProfileRepository.GetType());
Register does this:
public void Register(Type contractType, Type concreteType)
{
lock ( lockObject )
{
if ( instance.typeMappings.ContainsKey(contractType) )
{
instance.typeMappings.Remove(contractType);
}
instance.typeMappings.Add(contractType, concreteType);
}
}
and it blows up with "No parameterless constructor defined for this
object"
I can't figure out why....
--
You received this message because you are subscribed to the Google Groups
"Rhino.Mocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rhinomocks?hl=en.