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

On Mon, Dec 21, 2009 at 3:01 PM, [email protected] <[email protected]>wrote:

>        [TestMethod]
>        public void DeleteSchedOnDependencySpecification()
>        {
>            MockRepository repository = new MockRepository();
>            IDataAccess dal = repository.DynamicMock<IDataAccess>();
>            IServiceAgent agent = repository.DynamicMock<IServiceAgent>
> ();
>
>            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 <[email protected]> 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, [email protected] <
> [email protected]>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 [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<rhinomocks%[email protected]>
> <rhinomocks%2bunsubscr...@googlegrou­ps.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 -
>
> --
>
> 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]<rhinomocks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rhinomocks?hl=en.
>
>
>


-- 
Tim Barcz
Microsoft C# MVP
Microsoft ASPInsider
http://timbarcz.devlicio.us
http://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.


Reply via email to