public void ViewRemovedEventPassesTheViewRemovedInTheEventArgs() { object removedView = null; var regionManager = new MockRegionManager(); var control = new MockControl(); IRegion region = new RegionBase(control); region.RegionManager = regionManager; IView myView = new MockView(); region.Views.CollectionChanged += (sender, e) => { if (e.Action == NotifyCollectionChangedAction.Remove) { removedView = e.OldItems[0]; } }; region.Add(myView); Assert.IsNull(removedView); region.Remove(myView); Assert.AreSame(myView, removedView); }
public void RemoveViewFiresViewRemovedEvent() { bool viewRemoved = false; var regionManager = new MockRegionManager(); var control = new MockControl(); IRegion region = new RegionBase(control); region.RegionManager = regionManager; IView myView = new MockView(); region.Views.CollectionChanged += (sender, e) => { if (e.Action == NotifyCollectionChangedAction.Remove) { viewRemoved = true; } }; region.Add(myView); Assert.IsFalse(viewRemoved); region.Remove(myView); Assert.IsTrue(viewRemoved); }
public void RemoveNonexistViewNothingHappen() { var control = new MockControl(); IRegion region = new RegionBase(control); IView view = new MockView(); region.Remove(view); Assert.AreEqual(0, region.Views.Cast <object>().Count()); }
public void CanRemoveContentFromRegion() { var control = new MockControl(); IRegion region = new RegionBase(control); IView view = new MockView(); region.Add(view); region.Remove(view); Assert.AreEqual(0, region.Views.Cast <object>().Count()); }
public void GetViewReturnsNullAfterRemovingViewFromRegion() { var control = new MockControl(); IRegion region = new RegionBase(control); IView myView = new MockView(); region.Add(myView, "MyView"); region.Remove(myView); Assert.IsNull(region.GetView("MyView")); }
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)); }