I have set my unit test up in the following manner

            var unity = MockRepository.GenerateStub<IUnityContainer>
();
            var presenter =
MockRepository.GenerateStub<IStatusBarViewPresenter>();
            var view = MockRepository.GenerateStub<IStatusBarView>();
            presenter.View = view;

            var eventAggregator =
MockRepository.GenerateStub<IEventAggregator>();
            var regionManager =
MockRepository.GenerateStub<IRegionManager>();
            var region = MockRepository.GenerateStub<IRegion>();
            var regionCollection =
MockRepository.GenerateMock<IRegionCollection>();
            regionCollection.Add(RegionNames.StatusBarRegion, region);

            regionManager.Stub(r => r.Regions).Return
(regionCollection);

when I run through the test in debug Mode and set a breakpoint on the
final line, if I then inspect "regionCollection" it contains zero
children, instead of the expected "region", now I understand that the
"regionCollection" is merely a mock object and and when generated the
MockRepository has no idea about what kind of object it is mocking and
therefore will not auto-generate the functionality required of the Add
method.

I am also pretty certain that I can stub the required behaviour,
unfortunately, I do not know how to do such :o(

Any and all help will be greatly appreciated.

Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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