[Test]
        public void ProjectPresenter_LoadProject_ShouldLoadAProject()
        {

            //Create mock objects
            MockRepository mockRepository = new MockRepository();
            IProjectView view = mockRepository.Stub<IProjectView>();
            IProjectService service =
mockRepository.StrictMock<IProjectService>();
            IRedirector redirector =
mockRepository.StrictMock<IRedirector>();

            //Initial SUT
            ProjectPresenter presenter = new ProjectPresenter(view,
service, redirector);

            //Setup Stub
            Guid viewIdentity = Guid.NewGuid();
            SetupResult.For(view.Identity).Return(viewIdentity);
            view.Mode = DisplayMode.Edit;

            //Setup other objects used in test case
            Guid id = Guid.NewGuid();
            PrefetchPath2 prefetchPath = new PrefetchPath2((int)
EntityType.ProjectEntity)
                                             {
 
ProjectEntity.PrefetchPathContact,
 
ProjectEntity.PrefetchPathProjectPaybackPeriod,
 
ProjectEntity.PrefetchPathProjectCategory
                                             };


            ProjectEntity entity = new ProjectEntity
            {
                Id = id,
                Name = "Test Project",
                InitiatedBy = "Blair Davidson",
                ProjectNumber = "PRJ001",
                StartDate = new DateTime(2008, 12, 5),
                EndDate = new DateTime(2008, 12, 20),
                ProjectedSavingUnitYr = 100,
                ProjectedSavingDollarYr = 1000,
                Notes = "Test Notes"

            };

            //Set expectations
            Expect.Call(service.FindByIdentity(viewIdentity,
prefetchPath)).Return(entity);

            //Move into replay mode
            mockRepository.ReplayAll();

            //Call SUT
            presenter.LoadProject();

            //Additional assertions
            Assert.AreEqual(entity.ProjectNumber, view.ProjectNumber);
            Assert.AreEqual(entity.Name, view.ProjectName);
            Assert.AreEqual(entity.InitiatedBy, view.InitiatedBy);
            Assert.AreEqual(entity.StartDate, view.StartDate);
            Assert.AreEqual(entity.EndDate, view.EndDate);
            Assert.AreEqual(entity.ProjectedSavingUnitYr,
view.ProjectedSavingsUnitYear);
            Assert.AreEqual(entity.ProjectedSavingDollarYr,
view.ProjectedSavingsDollarYear);
            Assert.AreEqual(entity.ActualSavingsUnitYr,
view.ActualSavingsUnitYear);
            Assert.AreEqual(entity.ActualSavingsDollarYr,
view.ActualSavingsDollarYear);
            Assert.AreEqual(entity.Notes, view.Notes);
            Assert.AreEqual(entity.Version, view.Version);

            //Verify expectations
            mockRepository.VerifyAll();
        }

I am still using the prefetch path but is doesnt care abt the
constraints and the other test does.
What are your thoughts



On Dec 8, 11:58 am, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> Oh my, that was a slip.I meant, you are telling Rhino Mocks to expect a call
> with that particular parameters and to not consider anything else to match
> this expectation
>
>
>
> On Sun, Dec 7, 2008 at 9:56 PM, Blair <[EMAIL PROTECTED]> wrote:
>
> > Actually im using LLBLGen. I dont get what mean.
>
> > On Dec 8, 11:55 am, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> > > That is because without the constraints, you are telling NH that you want
> > to
> > > look for a call with that particular ID and that particual feth path
>
> > > On Sun, Dec 7, 2008 at 9:46 PM, Blair <[EMAIL PROTECTED]>
> > wrote:
>
> > > > Hi Guys,
> > > >                  I am a huge fan of rhino mocks but I have a question
> > > > regarding constraints.
>
> > > > Below is a code snippit of setting an expectation
> > > >           Expect.Call(facilityService.FindByIdentity(id,
> > > > prefetchPath))
> > > >               .Return(entity)
> > > >               .Constraints(Is.TypeOf(typeof(Guid)), Is.TypeOf(typeof
> > > > (IPrefetchPath2)));
>
> > > > If I take the constraints out it doesnt work but when I add them
> > > > everything is okay. the facilityService is create using the Strict
> > > > mock call.
>
> > > > The ususual thing is on some unit tests I need to add constraints like
> > > > this and other times I don't so it is a little inconsistent.
>
> > > > Can you explain why I need to do this and wether this is a problem
> > > > with the tool or just me missing something and using it
> > > > incorrectly. :)
>
> > > > Kind Regards,
>
> > > > Blair Davidson- Hide quoted text -
>
> > > - Show quoted text -- 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]
For more options, visit this group at 
http://groups.google.com/group/RhinoMocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to