コード例 #1
0
        public void ShouldRunControllerOnInitialization()
        {
            var     regionManager   = new MockRegionManager();
            var     container       = new MockUnityResolver();
            IModule module          = new WatchModule(container, regionManager);
            var     contentRegistry = new MockRegionViewRegistry();

            ServiceLocator.SetLocatorProvider(
                () => new MockServiceLocator(
                    () => contentRegistry));
            container.Bag.Add(typeof(IAddWatchPresenter), new MockAddWatchPresenter());
            container.Bag.Add(typeof(IWatchListPresentationModel), new MockWatchListPresentationModel());
            var controller = new MockWatchListController();

            container.Bag.Add(typeof(IWatchListController), controller);
            regionManager.Regions.Add("MainToolBarRegion", new MockRegion());

            module.Initialize();

            Assert.IsTrue(controller.RunCalled);
        }
コード例 #2
0
ファイル: WatchModuleFixture.cs プロジェクト: eslahi/prism
        public void ShouldRunControllerOnInitialization()
        {
            var regionManager = new MockRegionManager();
            var container = new MockUnityResolver();
            IModule module = new WatchModule(container, regionManager);
            var contentRegistry = new MockRegionViewRegistry();
            ServiceLocator.SetLocatorProvider(
               () => new MockServiceLocator(
                       () => contentRegistry));
            container.Bag.Add(typeof(IAddWatchPresenter), new MockAddWatchPresenter());
            container.Bag.Add(typeof(IWatchListPresentationModel), new MockWatchListPresentationModel());
            var controller = new MockWatchListController();
            container.Bag.Add(typeof(IWatchListController), controller);
            regionManager.Regions.Add("MainToolBarRegion", new MockRegion());

            module.Initialize();

            Assert.IsTrue(controller.RunCalled);
        }