public void WillSyncRegionContext() { RegionContextAwareRegionBehavior target = new RegionContextAwareRegionBehavior(); target.Region = new Region(); target.Attach(); var view = new MockRegionContextAwareView(); target.Region.Add(view); target.Region.Context = "Blurp"; Assert.AreEqual("Blurp", view.RegionContext.Value); view.RegionContext.Value = "Slurp"; Assert.AreEqual("Slurp", target.Region.Context); }
public void WillDetachEventsAfterRemove() { RegionContextAwareRegionBehavior target = new RegionContextAwareRegionBehavior(); target.Region = new Region(); target.Attach(); var view = new MockRegionContextAwareView(); WeakReference viewReference = new WeakReference(view); target.Region.Add(view); target.Region.Remove(view); target.Region.Context = "Blurp"; Assert.IsNull(view.RegionContext.Value); view.RegionContext.Value = "Slurp"; Assert.AreEqual("Blurp", target.Region.Context); }