It seems a bit more complicated than I first thought. If I have a
property that's being set on a mocked object, I do need to use the
syntax specified in the PDF I quoted:

//expect a setter to be called (value unimportant)
student.FirstName = "David";
LastCall.IgnoreArguments(); //use LastCall to set expectation details

However, if the property being accessed by teh method being tested is
a nested property, e.g.
//expect a setter to be called (value unimportant)
student.PostalAddress.Street = "18 DynamicMock Road";
LastCall.IgnoreArguments(); //use LastCall to set expectation details

This seems to fail and the syntax needs to be

Address addressObj = new Address();
addressObj.Street = "18 DynamicMock Road";

Expect.Call(student.PostalAddress).Return(addressObj);
LastCall.Repeat.Once(); //or LastCall.IgnoreArguments();


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to