public void TestNotifyCustomEvent() { var property = new ObservableProperty<string>("initVal"); string notifiedValue = null; var subscription = property.SubscribeEvent<string>(value => notifiedValue = value, "myEvent", "test"); property.OnNotifySubscribers("bla", "undefinedEvent"); Assert.IsNull(notifiedValue); property.OnNotifySubscribers("expected", "myEvent"); Assert.AreEqual("expected", notifiedValue); }
public void TestUnsubscribeCustomEvent() { var property = new ObservableProperty<string>("initVal"); string notifiedValue = null; var subscription = property.Subscribe(value => notifiedValue = value, "test", "myEvent"); subscription.Dispose(); property.OnNotifySubscribers("ignore", "myEvent"); Assert.IsNull(notifiedValue); }