public void InitAddsAddWatchControlViewToToolbarRegion() { var toolbarRegion = new MockRegion(); var collapsibleRegion = new MockRegion(); var regionManager = new MockRegionManager(); var container = new MockUnityResolver(); container.Bag.Add(typeof(IAddWatchPresenter), new MockAddWatchPresenter()); container.Bag.Add(typeof(IWatchListPresentationModel), new MockWatchListPresentationModel()); IModule module = new WatchModule(container, regionManager); regionManager.Regions.Add("WatchRegion", collapsibleRegion); regionManager.Regions.Add("MainToolbarRegion", toolbarRegion); Assert.AreEqual(0, toolbarRegion.AddedViews.Count); Assert.AreEqual(0, collapsibleRegion.AddedViews.Count); module.Initialize(); Assert.AreEqual(1, toolbarRegion.AddedViews.Count); Assert.AreEqual(1, collapsibleRegion.AddedViews.Count); }
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")); }
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); }