public void ShouldAddLibraryViewToAssetBrowserRegion()
        {
            var regionViewRegistry = new MockRegionViewRegistry();
            var container          = new MockUnityResolver();
            var menuButtonView     = new MockMenuButtonView();

            MockLibraryViewPresentationModel libraryViewModel = new MockLibraryViewPresentationModel();

            container.Bag[typeof(ILibraryViewPresentationModel)] = libraryViewModel;

            MockLibraryMenuButtonViewModel menuViewModel = new MockLibraryMenuButtonViewModel();

            menuViewModel.View = menuButtonView;

            container.Bag[typeof(IMenuButtonViewModel)] = menuViewModel;

            var module = new LibraryModule(container, regionViewRegistry);

            Assert.AreEqual(0, regionViewRegistry.ViewsByRegion.Count);

            module.Initialize();

            Assert.AreEqual(1, regionViewRegistry.ViewsByRegion.Count);
            Assert.AreSame(libraryViewModel.View, regionViewRegistry.ViewsByRegion[RegionNames.AssetBrowserRegion]);
        }
Пример #2
0
        public void ShouldAddLibraryViewToToolsRegion()
        {
            var toolsRegion   = new MockRegion();
            var regionManager = new MockRegionManager();
            var container     = new MockUnityResolver();

            container.Bag.Add(typeof(ILibraryViewPresentationModel), new MockLibraryViewPresentationModel());

            regionManager.Regions.Add("ToolsRegion", toolsRegion);

            var module = new LibraryModule(container, regionManager);

            Assert.AreEqual(0, toolsRegion.AddedViews.Count);

            module.Initialize();

            Assert.AreEqual(1, toolsRegion.AddedViews.Count);
            Assert.IsInstanceOfType(toolsRegion.AddedViews[0], typeof(ILibraryView));
        }