Hi,
Is it possible to stub a property with a private (or protected)
setter?
public class Person
{
public virtual string Name { get; private set; }
}
[Test]
public void CanStub()
{
var personStub = MockRepository.GenerateStub<Person>();
personStub.Stub(p => p.Name).Return("Joe");
Assert.AreEqual("Joe", personStub.Name);
}
The above test gives an error "You are trying to set an expectation on
a property that was defined to use PropertyBehavior." and suggests
assigning a value directly - which we can't since the setter is
private.
Thanks!
Brian
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---