Ejemplo n.º 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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public void InitAddsAddWatchControlViewToToolbarRegion()
        {
            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());
            container.Bag.Add(typeof(IWatchListController), new MockWatchListController());
            regionManager.Regions.Add("MainToolBarRegion", new MockRegion());

            Assert.AreEqual(0, contentRegistry.RegisterViewWithRegionRegionNameArg.Count);

            module.Initialize();

            Assert.AreEqual(1, contentRegistry.RegisterViewWithRegionRegionNameArg.Count);
            Assert.IsTrue(contentRegistry.RegisterViewWithRegionRegionNameArg.Contains("MainToolBarRegion"));
        }
Ejemplo n.º 4
0
        public void InitAddsAddWatchControlViewToToolbarRegion()
        {
            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());
            container.Bag.Add(typeof(IWatchListController), new MockWatchListController());
            regionManager.Regions.Add("MainToolBarRegion", new MockRegion());

            Assert.AreEqual(0, contentRegistry.RegisterViewWithRegionRegionNameArg.Count);

            module.Initialize();

            Assert.AreEqual(1, contentRegistry.RegisterViewWithRegionRegionNameArg.Count);
            Assert.IsTrue(contentRegistry.RegisterViewWithRegionRegionNameArg.Contains("MainToolBarRegion"));
        }