It is definitely being called, I've stepped through the code. The TestCase attributes effectively create 3 different tests that are called from the same test fixture instance.
For [TestCase(0)] the tests pass. When [TestCase(1)] runs, I get the following exception: ExpectationViolationException : IIncidentManagementMessageProcessorClient.Start(any); Expected #1, Actual #2. When [TestCase(2)] runs, I get the following exception: ExpectationViolationException : IIncidentManagementMessageProcessorClient.Start(any); Expected #1, Actual #3. It is almost like I need to clear the expectations after each parameterised run. I'll look up the Rhino.Mocks wiki. 2009/1/10 Simone Busoli <simone.bus...@gmail.com> > Well then the code under test is broken, it means that your > processorClient.Start method is not called. There's nothing else in your > test that could make it fail, since in the assertion you're ignoring the > arguments. BTW, that is not the best way to ignore the arguments. Look it > up in the RhinoMocks wiki. > > > On Sat, Jan 10, 2009 at 8:55 PM, Paul Cowan <dag...@scotalt.net> wrote: > >> I did'nt show the paste in the whole method. Just enough to really ask >> the question. >> >> The whole method now looks like this: >> >> [ >> TestCase(0)] >> [TestCase(1)] >> [TestCase(2)] >> public void Then_the_message_should_only_send_sms_messages(intresendAttempts) >> { >> string messageResendJSON = null; >> >> if (resendAttempts > 0) >> { >> messageResendJSON = (new List<MessageResend>{new >> MessageResend(_message, >> MessageType.SMSMessage, >> resendAttempts)}).ToJSON(); >> } >> >> _incidentManagementController.InitialiseBlanketMessage(_callTree.Uid, >> MESSAGE_TEXT, >> MessageType.SMSMessage, messageResendJSON); >> >> _processorClient.AssertWasCalled(x => x.Start(null >> ), opt => opt.IgnoreArguments()); >> } >> >> The initial error I described still exists after the first paramter has >> been passed into the test. >> >> >> >> 2009/1/10 Simone Busoli <simone.bus...@gmail.com> >> >>> You're welcome. Anyways, I think the point of your question was another >>> one. As far as I can see you're not using the input parameters of the test, >>> what are they for? >>> >>> On Sat, Jan 10, 2009 at 8:35 PM, Paul Cowan <dag...@scotalt.net> wrote: >>> >>>> You are correct. >>>> >>>> It seems my knowledge of stubs is wrong. >>>> >>>> I thought I would have to stub out the method to ensure that it was >>>> called. >>>> >>>> Cheers for pointing that out, >>>> >>>> 2009/1/10 Simone Busoli <simone.bus...@gmail.com> >>>> >>>>> No, it's not. What is the first call to stub for? It doesn't set any >>>>> expectation and doesn't return any value, so I think you could remove it. >>>>> >>>>> >>>>> On Sat, Jan 10, 2009 at 8:19 PM, Paul Cowan <dag...@scotalt.net>wrote: >>>>> >>>>>> >> I don't understand your test. In particular, the first call to >>>>>> Stub what is supposed to do? It is doing nothing. >>>>>> >>>>>> It gets called deep inside the >>>>>> _incidentManagementController.InitialiseBlanketMessage method. >>>>>> >>>>>> _processorClient is a dependency of the >>>>>> _incidentManagementController. The dependency is set int the [SetUp]. >>>>>> >>>>>> Any clearer? >>>>>> >>>>>> 2009/1/10 Simone Busoli <simone.bus...@gmail.com> >>>>>> >>>>>> and don't understand what you're doing with the test arguments, where >>>>>>> do you use them? >>>>>>> >>>>>>> >>>>>>> On Sat, Jan 10, 2009 at 7:32 PM, Simone Busoli < >>>>>>> simone.bus...@gmail.com> wrote: >>>>>>> >>>>>>>> I don't understand your test. In particular, the first call to Stub >>>>>>>> what is supposed to do? It is doing nothing. >>>>>>>> >>>>>>>> >>>>>>>> On Sat, Jan 10, 2009 at 4:37 PM, Paul Cowan <dag...@scotalt.net>wrote: >>>>>>>> >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> I am trying to run the following tests using the new paramaterised >>>>>>>>> features of NUnit 2.5 >>>>>>>>> >>>>>>>>> Here is my test: >>>>>>>>> >>>>>>>>> [ >>>>>>>>> TestCase(false, 0)] >>>>>>>>> [TestCase(true, 1)] >>>>>>>>> [TestCase(true, 2)] >>>>>>>>> public void Then_the_message_should_only_send_sms_messages(boolresend, >>>>>>>>> int resendAttempts) >>>>>>>>> { >>>>>>>>> _processorClient.Stub(x => x.Start(null)).IgnoreArguments(); >>>>>>>>> >>>>>>>>> >>>>>>>>> _incidentManagementController.InitialiseBlanketMessage(_callTree.Uid, >>>>>>>>> MESSAGE_TEXT); >>>>>>>>> >>>>>>>>> _processorClient.AssertWasCalled(x => x.Start(null), opt => >>>>>>>>> opt.IgnoreArguments()); >>>>>>>>> } >>>>>>>>> >>>>>>>>> The test passes the first time but for the following 2 test cases, >>>>>>>>> I get ExpectedViolation exceptions: >>>>>>>>> >>>>>>>>> Expected #1, Actual #3. >>>>>>>>> Expected #1, Actual #2. >>>>>>>>> >>>>>>>>> Can anyone see what I am doing wrong? I've tried placing Repeat on >>>>>>>>> the stub but get the same error. >>>>>>>>> >>>>>>>>> Cheers >>>>>>>>> >>>>>>>>> Paul >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" group. To post to this group, send email to rhino-tools-dev@googlegroups.com To unsubscribe from this group, send email to rhino-tools-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rhino-tools-dev?hl=en -~----------~----~----~----~------~----~------~--~---