コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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));
        }