IMHO it would be helpful in scenario 2, to output something like: " IFoo.Method(equal to tim); Expected #1, Actual #0. However, the method has been called with these parameters: - larry "
On 27 Aug., 02:46, Tim Barcz <[email protected]> wrote: > This is really hard to do. Consider the following: > > *Scenario 1:* > [Test] > public void Test() > { > var view = MockRepository.GenerateMock<IFoo>(); > > view.Method("tim"); > > view.AssertWasCalled(x=>x.Method("tim")); > > } > > *Scenario 2:* > [Test] > public void Test() > { > var view = MockRepository.GenerateMock<IFoo>(); > > view.Method("larry"); > > view.AssertWasCalled(x=>x.Method("tim")); > > } > > *Scenario 3:* > [Test] > public void Test() > { > var view = MockRepository.GenerateMock<IFoo>(); > > view.AssertWasCalled(x=>x.Method("tim")); > > } > > Scenario 1 passes just fine and is the example. Scenarios 2 & 3 however > will fail. > > When trying to report back all RhinoMocks knows is that something didn't get > called. It doesn't know that "you were close" that your parameter was off > by a single character. The reason is it could be false positive. In the > above there are two very different things going on between #2 and #3. In #2 > the wrong param is called, in #3 the method isn't called at all. > > The best Rhino could do in my mind is tell give you a list of what was > called. It would then be up to the end user to reconcile that list to what > was expected, and in some ways that's already going on when the error > message tells you something was expected but never called. > > Tim > > On Wed, Aug 26, 2009 at 2:06 PM, NetSplinter <[email protected]>wrote: > > > > > > > If I set an expectation on a call in a DynamicMock, when the > > expectation is not met by any call, I get an exception like the below: > > > Rhino.Mocks.Exceptions.ExpectationViolationException : > > YourClass.YourMethod(equal to Information, equal to MainOrchestration, > > equal to System.Exception: foo); Expected #1, Actual #0. > > > Without stepping into the the test case in the debugger, is there a > > way to get Rhino Mocks to include information about what calls & > > parameters were made to the mocked method, so I can see why I failed > > to meet the expectation just from inspecting the exception text? > > > Thanks! > > -- > Tim Barcz > ASPInsiderhttp://timbarcz.devlicio.ushttp://www.twitter.com/timbarcz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
