Exemplo n.º 1
0
        public void ShowViewFiresViewShowedEvent()
        {
            bool viewActivated = false;

            var     regionManager = new MockRegionManager();
            var     control       = new MockControl();
            IRegion region        = new RegionBase(control);

            region.RegionManager = regionManager;
            IView myView = new MockView();

            region.ActiveViews.CollectionChanged += (o, e) =>
            {
                if (e.Action == NotifyCollectionChangedAction.Add && e.NewItems.Contains(myView))
                {
                    viewActivated = true;
                }
            };
            region.Add(myView);
            Assert.IsFalse(viewActivated);

            region.Activate(myView);

            Assert.IsTrue(viewActivated);
        }
Exemplo n.º 2
0
        public void ActivateNullViewThrows()
        {
            var     regionManager = new MockRegionManager();
            var     control       = new MockControl();
            IRegion region        = new RegionBase(control);

            region.RegionManager = regionManager;
            IView nonAddedView = new MockView();

            region.Activate(null);
        }
Exemplo n.º 3
0
        public void RemovingViewAlsoRemovesItFromActiveViews()
        {
            var     regionManager = new MockRegionManager();
            var     control       = new MockControl();
            IRegion region        = new RegionBase(control);

            region.RegionManager = regionManager;
            IView myView = new MockView();

            region.Add(myView);
            region.Activate(myView);
            Assert.IsTrue(region.ActiveViews.Contains(myView));

            region.Remove(myView);

            Assert.IsFalse(region.ActiveViews.Contains(myView));
        }