public void TestInitialize() { this.container = new MockUnityContainer(); this.regionManager = new MockRegionManager(); this.menuButtonView = new MockAssetBrowserMenuButtonView(); this.windowManager = new MockWindowManager(); }
public void ShouldAddViewsToRegions() { var mainRegion = new MockRegion(); var menuRegion = new MockRegion(); var regionManager = new MockRegionManager(); var container = new MockUnityResolver(); var windowManager = new MockWindowManager(); container.Bag.Add(typeof(IProjectViewPresenter), new MockProjectViewPresenter()); container.Bag.Add(typeof(IMenuButtonViewModel), new MockProjectMenuButtonViewModel()); regionManager.Regions.Add("MainRegion", mainRegion); regionManager.Regions.Add("MenuRegion", menuRegion); var module = new ProjectsModule(container, regionManager, windowManager); Assert.AreEqual(0, mainRegion.AddedViews.Count); Assert.AreEqual(0, menuRegion.AddedViews.Count); module.Initialize(); Assert.AreEqual(1, mainRegion.AddedViews.Count); Assert.AreEqual(1, menuRegion.AddedViews.Count); Assert.IsInstanceOfType(mainRegion.AddedViews[0], typeof(IProjectView)); Assert.IsInstanceOfType(menuRegion.AddedViews[0], typeof(IMenuButtonView)); }
public void ShouldCreateRegion() { try { var regionManager = new MockRegionManager(); var windowManager = new MockWindowManager(); var dialogActivationBehavior = new DialogActivationBehavior(windowManager); ServiceLocator.SetLocatorProvider( () => new MockServiceLocator( new Tuple <Type, Func <object> >(typeof(IRegionManager), () => regionManager), new Tuple <Type, Func <object> >(typeof(DialogActivationBehavior), () => dialogActivationBehavior))); FrameworkElement hostControl = new MockFrameworkElement(); RegionWindowBehaviors.RegisterNewWindowRegion(hostControl, "MyPopupRegion"); Assert.IsTrue(regionManager.MockRegions.Regions.ContainsKey("MyPopupRegion")); Assert.IsNotNull(regionManager.MockRegions.Regions["MyPopupRegion"]); Assert.IsInstanceOfType(regionManager.MockRegions.Regions["MyPopupRegion"], typeof(AllActiveRegion)); Assert.IsTrue(regionManager.MockRegions.Regions["MyPopupRegion"].Behaviors.ContainsKey(DialogActivationBehavior.BehaviorKey)); Assert.IsInstanceOfType(regionManager.MockRegions.Regions["MyPopupRegion"].Behaviors[DialogActivationBehavior.BehaviorKey], typeof(DialogActivationBehavior)); } finally { ServiceLocator.SetLocatorProvider(() => null); } }
public void TestInitialize() { this.unityContainer = new MockUnityContainer(); this.regionManager = new MockRegionManager(); this.menuButtonView = new MockSubClipMenuButtonView(); this.windowManager = new MockWindowManager(); }
public void WindowManagerEnsureWindowForUserControlTest() { var windowManager = new MockWindowManager(_viewManager); UserControl userControl = new MockUserControlView(); var view = windowManager.EnsureWindow(userControl, false); Assert.AreSame(userControl, view.Content); }
public void WindowManagerEnsureWindowForWindowTest() { var windowManager = new MockWindowManager(_viewManager); Window window = new MockWindowView(); var view = windowManager.EnsureWindow(window, false); Assert.AreSame(window, view); }
public void ShouldAddSettingsMenuButtonViewToMenuRegion() { var windowManager = new MockWindowManager(); var container = new MockUnityResolver(); var regionManager = new MockRegionManager(); var module = new SettingsModule(container, regionManager, windowManager); var menuButtonView = new MockMenuButtonView(); ISettingsViewPresentationModel settingsViewModel = new MockSettingsViewPresentationModel(); container.Bag.Add(typeof(ISettingsViewPresentationModel), settingsViewModel); container.Bag.Add(typeof(IIncreasePersistenceQuotaViewModel), new MockIncreasePersistenceQuotaViewModel()); MockSettingsMenuButtonViewModel menuViewModel = new MockSettingsMenuButtonViewModel(); menuViewModel.View = menuButtonView; container.Bag[typeof(IMenuButtonViewModel)] = menuViewModel; MockRegion menuRegion = new MockRegion { Name = "MenuRegion" }; MockRegion mainRegion = new MockRegion { Name = "MainRegion" }; regionManager.Regions.Add(menuRegion); regionManager.Regions.Add(mainRegion); Assert.AreEqual(0, menuRegion.AddedViews.Count); module.Initialize(); Assert.AreSame(settingsViewModel.View, menuViewModel.ViewToDisplay); Assert.IsTrue(menuViewModel.IsViewActive); Assert.AreEqual(1, menuRegion.AddedViews.Count); Assert.IsNotNull(menuViewModel.View); Assert.AreSame(menuViewModel.View, menuRegion.AddedViews[0]); Assert.AreEqual("Settings", menuViewModel.Text); }
public void SetUp() { this.windowManager = new MockWindowManager(); }