rhino mocks - RhinoMocks expecting call with the exact value -


Sometimes rhino.mox is driving me crazy, 'because there are not enough documents on the subjects, I think, relatively Are easy.

What I want to do is call the call for an add-contract ("test", contact). Therefore, for the second parameter I should use the parameter constraint property. AllPropertiesMatch (contact) but should I use for the first time?

  _contactManagerMock. Expat (M => M. Addaccept (empty, empty)). Restraint (Property, Property. All Properties Match (Contact));  

"Customize" What happens instead of

I was also searching for it, here's a more detailed answer .

This is an example of using AllPropertyMatch in Rhino. I tested it in Rhino. 3.6 moe ocks.

  // Manage different contacts Managerager = MockRepository.GenerateMock & lt; IManager & gt; (); ContactManagerMock.Expect (m = & gt; m.AddContact (Arg.Is ("test"), Arg & lt; Contact & gt; .Matches (Est. AllPropertiesMatch (Contact))) / / Act above expected call / Contact Manager / Mac Verify all estimates ();  

It expects that the AddContact method should be called. The first parameter value should be a string with 'test', one must be the second type of object which has all the same properties as the example of the contact. VerifyAllExpectations claims calling.

More information on the site.


Comments