示例#1
0
 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);
 }
示例#2
0
 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);
 }