Ayende, Thank you for that, it clears up some confusion.
Still the above code is failing at the SetupResult.For call (it never even gets to the Assert call). I would like to know how to make my mocks have the stub like PropertyBehavior (even if I can't assert on it then). On Aug 19, 12:51 pm, Ayende Rahien <[email protected]> wrote: > Stephen, If you specify PropertyBehavior, it behave like a property. > That means that you can't assert on calls on it. > If you want to check that it was set, you can check the value in it. > > On Wed, Aug 19, 2009 at 9:47 PM, Stephen Schaff <[email protected]> wrote: > > > I would really appreciate a working example of using PropertyBehavior > > in Rhino Mocks 3.5. > > > Here is what I have (that does not work) > > > [TestMethod] > > public void RandomTest() > > { > > var addressForm = > > MockRepository.GenerateMock<IAddAddressForm>(); > > > SetupResult.For(addressForm.FirstName).PropertyBehavior(); > > addressForm.FirstName = "Bob"; > > string name = addressForm.FirstName; > > addressForm.AssertWasCalled(x => { var ignored = > > x.FirstName; }); > > Assert.AreEqual(name, addressForm.FirstName); > > } > > > This uses the following Interface: > > public interface IAddAddressForm > > { > > string FirstName { get; set; } > > } > > > When I run the test I get this error: > > System.InvalidOperationException: Invalid call, the last call has been > > used or no call has been made (make sure that you are calling a > > virtual (C#) / Overridable (VB) method).. > > > If you know what I am doing wrong, then that would be great, but > > otherwise I would just love a working example of how to make a > > property of a mock use PropertyBehavior using 3.5 (no Replay/ReplayAll > > please! There are Tons of examples using that syntax) > > > Hoping I get a response, > > Stephen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
