Here's the error message that we are getting:
"Test method [method name here] threw exception:
System.InvalidOperationException: This action is invalid when the mock
object is in verified state.."
What does this exception mean? I am seeing this error on 2 other
tests... so only 3 tests out of our 330 tests are getting this
exception when executed from the build server.
Any guidance would be greatly appreciated.
--
You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group.
To post to this group, send email to rhino...@googlegroups.com.
To unsubscribe from this group, send email to rhinomocks+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rhinomocks?hl=en.
int gateId = 1;
Yard yard = new Yard { YardId = 1, IpAddress =
"localhost" };
using (repository.Record())
{
dal.GetYardByGateId(gateId);
LastCall.Return(yard);
agent.DeleteSched(default(Guid), yard.IpAddress);
LastCall.IgnoreArguments().Return(true);
}
ManagerRegistry.GateEventManager.YardServiceAgent = agent;
ManagerRegistry.SetYardManager(dal);
ManagerRegistry.GateEventManager.DeleteSched(default
(Guid), gateId);
repository.VerifyAll();
}
The ManagerRegistry.GateEventManager component exposes a "DeleteSched"
method that internally uses the second paramater to look up
encapsulated knowledge (i.e. Yard.IpAddress). The
ManagerRegistry component manages the singleton nature of the
GateEventManager component.
When I run just this test locally it passes with no exceptions. When I
run this in conjunction with other tests it fails.
The test always fails on the following line:
"ManagerRegistry.GateEventManager.YardServiceAgent = agent;"
On Dec 21, 1:41 pm, Tim Barcz <timba...@gmail.com> wrote:
> Can you please post the test here? I suspect you're using Record/Replay
> semantics?
>
> Tim
>
> On Mon, Dec 21, 2009 at 2:20 PM, zkBier...@gmail.com <zkbier...@gmail.com>wrote:
>
>
>
>
>
> > In our project we currently have ~330 tests (50% integration tests,
> > 50% isolated unit tests). One test in particular passes locally, but
> > fails during our continuous integration build.
>
> > Here's the error message that we are getting:
>
> > "Test method [method name here] threw exception:
> > System.InvalidOperationException: This action is invalid when the mock
> > object is in verified state.."
>
> > What does this exception mean? I am seeing this error on 2 other
> > tests... so only 3 tests out of our 330 tests are getting this
> > exception when executed from the build server.
>
> > Any guidance would be greatly appreciated.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Rhino.Mocks" group.
> > To post to this group, send email to rhino...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rhinomocks+...@googlegroups.com<rhinomocks%2Bunsubscribe@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rhinomocks?hl=en.
>
> --
> Tim Barcz
> Microsoft C# MVP
> Microsoft ASPInsiderhttp://timbarcz.devlicio.ushttp://www.twitter.com/timbarcz- Hide quoted text -
>
> - Show quoted text -
To unsubscribe from this group, send email to rhinomocks+...@googlegroups.com.
On Dec 21, 3:39 pm, Tim Barcz <timba...@gmail.com> wrote:
> Are you missing
>
> using (repository.Playback())
> {
>
> }
>
> around the ManagerRegistry calls? It seems as though you're mixing the
> classic and "using" syntaxes for Record/Replay.
>
> Tim
>