Please create a small, stand alone test that reproduce the issue

On Thu, Oct 9, 2008 at 12:08 PM, uTILLIty <[EMAIL PROTECTED]> wrote:

>
> In my test using _controller.Expect(...) and
> _controller.VerifyAllExpecteations() is not working, but in the same
> test checking _controller.AssertWasCalled() works! The unit-test fails
> on the last line:
> _controller.VerifyAllExpectations();
>
>
> Here's the output of the test:
> ReceiveMessageFixture.ReceiveMessage_LocalRecipient :
> FailedReceiveMessageFixtur   7T 53:51.055: WorkflowCreated
> ReceiveMessageFixtur   7T 53:51.069: WorkflowStarted
> UpdateProcessingStat  10T 53:51.167: Updating status to Created for
> GroupId 1. ReceiveMessage Workflow has been started
> ReceiveMessageFixtur  10T 53:51.195: controller.GetRecipientCount
> UpdateProcessingStat  10T 53:51.232: Updating status to Formatting for
> GroupId 1. [no message supplied]
> ReceiveMessageFixtur  10T 53:51.232: controller.Format(d9ad2c07-
> ef80-4d25-ada8-6321a35336b7)
> ReceiveMessageFixtur  10T 53:51.265: WorkflowIdled
> ReceiveMessageFixtur  11T 53:51.435:
> controller.GetWorkflowIdForMessageId
>      ReceiveMessage  11T 53:51.460: Received Event from
> TestReceivedMessageController
> UpdateProcessingStat  11T 53:51.460: Updating status to Formatted for
> GroupId 1. [no message supplied]
> ReceiveMessageFixtur  11T 53:51.460: controller.CheckIsLocalMessage
> UpdateProcessingStat  11T 53:51.460: Updating status to Formatted for
> GroupId 1. Message is for a local recipient.
> ReceiveMessageFixtur  11T 53:51.460: controller.ProcessReceiptRequest
> ReceiveMessageFixtur  11T 53:51.460:
> controller.NotifyInboundMessageReceived
> UpdateProcessingStat  11T 53:51.475: Updating status to Success for
> GroupId 1. [no message supplied]
> ReceiveMessageFixtur  11T 53:51.496: WorkflowCompleted
>
> Rhino.Mocks.Exceptions.ExpectationViolationException:
> TestReceivedMessageController.Format(d9ad2c07-ef80-4d25-
> ada8-6321a35336b7); Expected #1, Actual #0.
> TestReceivedMessageController.RaiseFormatted(d9ad2c07-ef80-4d25-
> ada8-6321a35336b7); Expected #1, Actual #0.
> TestReceivedMessageController.CheckIsLocalMessage(d9ad2c07-ef80-4d25-
> ada8-6321a35336b7); Expected #1, Actual #0.
> TestReceivedMessageController.ProcessReceiptRequest(d9ad2c07-ef80-4d25-
> ada8-6321a35336b7); Expected #1, Actual #0.
> TestReceivedMessageController.NotifyInboundMessageReceived(d9ad2c07-
> ef80-4d25-ada8-6321a35336b7); Expected #1, Actual #0.
> at Rhino.Mocks.Impl.ReplayMockState.Verify()
> at Rhino.Mocks.MockRepository.Verify(Object obj)
> at Rhino.Mocks.RhinoMocksExtensions.VerifyAllExpectations(Object
> mockObject)
> at
>
> Intercom.Mercury.Services.Workflows.ReceiveMessageFixture.ReceiveMessage_LocalRecipient()
> in ReceiveMessageFixture.cs: line 87
>
>
> and here my unit-test code:
> _controller =
> MockRepository.GenerateMock<TestReceivedMessageController>();
> _modelSvc = MockRepository.GenerateMock<IModelService>();
> ...
> var messageId = Guid.NewGuid();
> var wfInstId = messageId;
> var linkId = 1;
>
> _controller.Stub(c =>
> c.CheckIsLocalMessage(messageId)).Return(true).WhenCalled(c =>
> log("controller.CheckIsLocalMessage"));
> _controller.Stub(c =>
> c.GetRecipientCount(messageId)).Return(1).WhenCalled(c =>
> log("controller.GetRecipientCount"));
> _controller.Stub(c =>
> c.GetRecipientLinkIdForMessageId(messageId)).Return(linkId).WhenCalled(c
> => log("controller.GetRecipientLinkIdForMessageId"));
> _controller.Stub(c =>
> c.GetWorkflowIdForMessageId(messageId)).Return(wfInstId).WhenCalled(c
> => log("controller.GetWorkflowIdForMessageId"));
> _controller.Stub(c => c.ProcessReceiptRequest(messageId)).WhenCalled(c
> => log("controller.ProcessReceiptRequest"));
> _controller.Stub(c =>
> c.NotifyInboundMessageReceived(messageId)).WhenCalled(c =>
> log("controller.NotifyInboundMessageReceived"));
> _controller.Stub(c =>
>
> c.RaiseFormatted(messageId)).IgnoreArguments().CallOriginalMethod(OriginalCallOptions.CreateExpectation);
> _controller.Stub(c => c.RaiseGeneralError(messageId,
>
> "")).IgnoreArguments().CallOriginalMethod(OriginalCallOptions.CreateExpectation);
> _controller.Stub(c => c.Format(messageId))
> .WhenCalled(c =>
>        {
>                log("controller.Format({0})", c.Arguments[0]);
>                _controller.RaiseFormatted((Guid) c.Arguments[0]);
>        });
>
> _controller.Expect(c => c.Format(messageId));
> _controller.Expect(c => c.RaiseFormatted(messageId));
> _controller.Expect(c => c.CheckIsLocalMessage(messageId));
> _controller.Expect(c => c.ProcessReceiptRequest(messageId));
> _controller.Expect(c => c.NotifyInboundMessageReceived(messageId));
>
> var args = new Dictionary<string, object> {
>        {"MessageId", messageId},
>        {"RecipientLinkId", linkId}
> };
> _wf.Start(wfInstId, typeof(ReceiveMessage), args);
> whileWorkflowsActive();
> _controller.AssertWasCalled(c => c.Format(messageId));
> _controller.AssertWasCalled(c => c.RaiseFormatted(messageId));
> _controller.AssertWasCalled(c => c.CheckIsLocalMessage(messageId));
> _controller.AssertWasCalled(c => c.ProcessReceiptRequest(messageId));
> _controller.AssertWasCalled(c =>
> c.NotifyInboundMessageReceived(messageId));
> _controller.VerifyAllExpectations();
>
> >
>

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