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); }
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); }
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)); }