public void DeactivateNonAddedViewThrows() { var ex = Assert.Throws <ArgumentException>(() => { IRegion region = new Region(); var nonAddedView = new ContentView(); region.Deactivate(nonAddedView); }); }
public void ShouldFindCandidateViewWithFriendlyNameInRegion() { this.ConfigureMockServiceLocator(); // We cannot access the MefRegionNavigationContentLoader directly so we need to call its // GetCandidatesFromRegion method through a navigation request. IRegion testRegion = new Region(); MockView2 view = new MockView2(); testRegion.Add(view); testRegion.Deactivate(view); testRegion.RequestNavigate("SomeView"); Assert.IsTrue(testRegion.Views.Contains(view)); Assert.IsTrue(testRegion.Views.Count() == 1); Assert.IsTrue(testRegion.ActiveViews.Count() == 1); Assert.IsTrue(testRegion.ActiveViews.Contains(view)); }
public void ShouldFindCandidateViewInRegion() { IUnityContainer container = new UnityContainer(); container.RegisterType<object, MockView>("MockView"); this.ConfigureMockServiceLocator(container); // We cannot access the UnityRegionNavigationContentLoader directly so we need to call its // GetCandidatesFromRegion method through a navigation request. IRegion testRegion = new Region(); MockView view = new MockView(); testRegion.Add(view); testRegion.Deactivate(view); testRegion.RequestNavigate("MockView"); Assert.IsTrue(testRegion.Views.Contains(view)); Assert.IsTrue(testRegion.Views.Count() == 1); Assert.IsTrue(testRegion.ActiveViews.Count() == 1); Assert.IsTrue(testRegion.ActiveViews.Contains(view)); }
public void WhenParentViewGetsActivatedOrDeactivated_ThenSyncedChildViewNotInActiveViewsIsNotUpdated() { var scopedRegionManager = new RegionManager(); var scopedRegion = new Region { Name="MyScopedRegion", RegionManager = scopedRegionManager }; scopedRegionManager.Regions.Add(scopedRegion); var behaviorForScopedRegion = new RegionActiveAwareBehavior { Region = scopedRegion }; behaviorForScopedRegion.Attach(); var childActiveAwareView = new SyncedActiveAwareObject(); var region = new MockPresentationRegion(); var behavior = new RegionActiveAwareBehavior { Region = region }; behavior.Attach(); var view = new MockFrameworkElement(); region.Add(view); RegionManager.SetRegionManager(view, scopedRegionManager); region.Activate(view); scopedRegion.Add(childActiveAwareView); scopedRegion.Deactivate(childActiveAwareView); Assert.IsFalse(childActiveAwareView.IsActive); region.Deactivate(view); Assert.IsFalse(childActiveAwareView.IsActive); region.Activate(view); Assert.IsFalse(childActiveAwareView.IsActive); }
public void DeactivateNonAddedViewThrows() { IRegion region = new Region(); object nonAddedView = new object(); region.Deactivate(nonAddedView); }