public void ShouldAddSequencesViewToProjectBrowserRegion() { var regionManager = new MockRegionManager(); var regionViewRegistry = new MockRegionViewRegistry(); var container = new MockUnityResolver(); var menuButtonView = new MockMenuButtonView(); MockTimelinePresenter timelinePresenter = new MockTimelinePresenter(); MockSequencesViewModel sequenceViewModel = new MockSequencesViewModel(); container.Bag[typeof(ITimelinePresenter)] = timelinePresenter; container.Bag[typeof(ISequencesViewModel)] = sequenceViewModel; MockTimelineMenuButtonViewModel menuViewModel = new MockTimelineMenuButtonViewModel(); menuViewModel.View = menuButtonView; container.Bag[typeof(IMenuButtonViewModel)] = menuViewModel; MockRegion mainRegion = new MockRegion { Name = "MainRegion" }; MockRegion menuRegion = new MockRegion { Name = "MenuRegion" }; regionManager.Regions.Add(mainRegion); regionManager.Regions.Add(menuRegion); var module = new TimelineModule(container, regionManager, regionViewRegistry, this.windowManager); module.Initialize(); Assert.IsInstanceOfType(regionViewRegistry.ViewsByRegion[RegionNames.ProjectBrowserRegion], typeof(ISequencesView)); }
public void ShouldActivateViewOnWatchItemAdded() { try { var mockRegionContentRegistry = new MockRegionViewRegistry(); ServiceLocator.SetLocatorProvider( () => new MockServiceLocator( () => mockRegionContentRegistry)); var watchListView = new MockWatchListView(); var regionManager = new MockRegionManager(); var region = new MockRegion(); region.Add(watchListView); regionManager.Regions.Add("MainRegion", region); var presentationModel = new MockWatchListPresentationModel { View = watchListView }; WatchListController controller = new WatchListController(regionManager, presentationModel); controller.Run(); presentationModel.WatchListItems.Add(new WatchItem("MySymbol", 10m)); Assert.IsTrue(region.ActivateCalled); Assert.AreSame(watchListView, region.ActivateArg); } finally { ServiceLocator.SetLocatorProvider(() => null); } }
public void ShouldRegisterWatchListViewOnRegion() { try { var mockRegionContentRegistry = new MockRegionViewRegistry(); ServiceLocator.SetLocatorProvider( () => new MockServiceLocator( () => mockRegionContentRegistry)); var presentationModel = new MockWatchListPresentationModel(); var watchListView = new MockWatchListView(); presentationModel.View = watchListView; WatchListController controller = new WatchListController(new MockRegionManager(), presentationModel); controller.Run(); Assert.AreEqual(1, mockRegionContentRegistry.RegisteredViews.Count); Assert.IsTrue(mockRegionContentRegistry.RegisteredViews.ContainsKey("MainRegion")); Assert.AreSame(watchListView, mockRegionContentRegistry.RegisteredViews["MainRegion"]); } finally { ServiceLocator.SetLocatorProvider(() => null); } }
public void ShouldActivateViewOnWatchItemAdded() { try { var mockRegionContentRegistry = new MockRegionViewRegistry(); ServiceLocator.SetLocatorProvider( () => new MockServiceLocator( () => mockRegionContentRegistry)); var watchListView = new MockWatchListView(); var regionManager = new MockRegionManager(); var region = new MockRegion(); region.Add(watchListView); regionManager.Regions.Add("MainRegion", region); var presentationModel = new MockWatchListPresentationModel { View = watchListView }; WatchListController controller = new WatchListController(regionManager, presentationModel); controller.Run(); presentationModel.WatchListItems.Add(new WatchItem("MySymbol", 10m)); Assert.IsTrue(region.ActivateCalled); Assert.AreSame(watchListView, region.ActivateArg); } finally { ServiceLocator.SetLocatorProvider(() => null); } }
public void ShouldRegisterWatchListViewOnRegion() { try { var mockRegionContentRegistry = new MockRegionViewRegistry(); ServiceLocator.SetLocatorProvider( () => new MockServiceLocator( () => mockRegionContentRegistry)); var presentationModel = new MockWatchListPresentationModel(); var watchListView = new MockWatchListView(); presentationModel.View = watchListView; WatchListController controller = new WatchListController ( new MockRegionManager(), presentationModel); controller.Run(); Assert.AreEqual(1, mockRegionContentRegistry.RegisteredViews.Count); Assert.IsTrue(mockRegionContentRegistry.RegisteredViews.ContainsKey("MainRegion")); Assert.AreSame(watchListView, mockRegionContentRegistry.RegisteredViews["MainRegion"]); } finally { ServiceLocator.SetLocatorProvider(() => null); } }
public void ShouldAddSubClipCommentsBarViewToSubClipCommentsBarRegion() { var regionViewRegistry = new MockRegionViewRegistry(); var container = new MockUnityResolver(); var presenter = new MockCommentsBarPresenter(); container.Bag.Add(typeof(ICommentsBarPresenter), presenter); var module = new CommentsBarModule(container, regionViewRegistry); Assert.AreEqual(0, regionViewRegistry.ViewsByRegion.Count); module.Initialize(); Assert.AreSame(presenter.View, regionViewRegistry.ViewsByRegion[RegionNames.SubClipCommentsBarRegion]); }
public void ShouldAddMediaBinViewToProjectBrowserRegion() { var regionViewRegistry = new MockRegionViewRegistry(); var container = new MockUnityResolver(); var presentationModel = new MockMediaBinViewPresentationModel(); container.Bag.Add(typeof(IMediaBinViewPresentationModel), presentationModel); var module = new MediaBinModule(container, regionViewRegistry); Assert.AreEqual(0, regionViewRegistry.ViewsByRegion.Count); module.Initialize(); Assert.AreEqual(1, regionViewRegistry.ViewsByRegion.Count); Assert.AreSame(presentationModel.View, regionViewRegistry.ViewsByRegion[RegionNames.ProjectBrowserRegion]); }
public void ShouldAddTitlesViewToMainRegion() { var regionViewRegistry = new MockRegionViewRegistry(); var container = new MockUnityResolver(); var vm = new MockOverlaysViewModel(); container.Bag.Add(typeof(IOverlaysViewModel), vm); var module = new OverlaysModule(container, regionViewRegistry); Assert.AreEqual(0, regionViewRegistry.ViewsByRegion.Count); module.Initialize(); Assert.AreEqual(1, regionViewRegistry.ViewsByRegion.Count); Assert.AreSame(vm.View, regionViewRegistry.ViewsByRegion[RegionNames.AssetBrowserRegion]); }
public void ShouldAddSequenceMenuButtonViewToMenuRegion() { var container = new MockUnityResolver(); var regionManager = new MockRegionManager(); var regionViewRegistry = new MockRegionViewRegistry(); var module = new TimelineModule(container, regionManager, regionViewRegistry, this.windowManager); var menuButtonView = new MockMenuButtonView(); MockTimelinePresenter timelinePresenter = new MockTimelinePresenter(); container.Bag[typeof(ITimelinePresenter)] = timelinePresenter; MockTimelineMenuButtonViewModel menuViewModel = new MockTimelineMenuButtonViewModel(); menuViewModel.View = menuButtonView; container.Bag[typeof(IMenuButtonViewModel)] = menuViewModel; container.Bag.Add(typeof(ISequencesViewModel), new MockSequencesViewModel()); MockRegion mainRegion = new MockRegion { Name = "MainRegion" }; MockRegion menuRegion = new MockRegion { Name = "MenuRegion" }; regionManager.Regions.Add(mainRegion); regionManager.Regions.Add(menuRegion); Assert.AreEqual(0, menuRegion.AddedViews.Count); module.Initialize(); Assert.AreSame(timelinePresenter.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("Sequence", menuViewModel.Text); }
public void ShouldAddTimelineViewToMainRegion() { var regionViewRegistry = new MockRegionViewRegistry(); var regionManager = new MockRegionManager(); var container = new MockUnityResolver(); var menuButtonView = new MockMenuButtonView(); MockTimelinePresenter timelinePresenter = new MockTimelinePresenter(); container.Bag[typeof(ITimelinePresenter)] = timelinePresenter; MockTimelineMenuButtonViewModel menuViewModel = new MockTimelineMenuButtonViewModel(); menuViewModel.View = menuButtonView; container.Bag[typeof(IMenuButtonViewModel)] = menuViewModel; container.Bag.Add(typeof(ISequencesViewModel), new MockSequencesViewModel()); MockRegion mainRegion = new MockRegion { Name = "MainRegion" }; MockRegion menuRegion = new MockRegion { Name = "MenuRegion" }; regionManager.Regions.Add("MainRegion", mainRegion); regionManager.Regions.Add("MenuRegion", menuRegion); var module = new TimelineModule(container, regionManager, regionViewRegistry, this.windowManager); Assert.AreEqual(0, mainRegion.AddedViews.Count); module.Initialize(); Assert.AreEqual(1, mainRegion.AddedViews.Count); Assert.IsInstanceOfType(mainRegion.AddedViews[0], typeof(ITimelineView)); }