public void ShouldRemoveContextToViewRemovedFromRegion() { var behavior = new BindRegionContextToDependencyObjectBehavior(); var region = new MockPresentationRegion(); var view = new MockDependencyObject(); region.Add(view); behavior.Region = region; region.Context = "MyContext"; behavior.Attach(); region.Remove(view); var context = RegionContext.GetObservableContext(view); Assert.IsNull(context.Value); }
public void WhenAViewIsRemovedFromARegion_ThenRegionContextIsNotClearedInRegion() { var behavior = new BindRegionContextToDependencyObjectBehavior(); var region = new MockPresentationRegion(); behavior.Region = region; behavior.Attach(); var myView = new MockFrameworkElement(); region.Add(myView); region.Context = "new context"; region.Remove(myView); Assert.IsNotNull(region.Context); }