示例#1
0
        public void NestedObservables()
        {
            _handle = new EventWaitHandle(false, EventResetMode.ManualReset);
            var test = new ObservableList <ObservableItem>();

            test.ItemChanged += ObservableItemChanged;
            var item = new ObservableItem();

            test.Add(item);
            item.ReportChange();
            Assert.IsTrue(_handle.WaitOne(10));
        }
        public void NestedObservables()
        {
            _handle = new EventWaitHandle(false, EventResetMode.ManualReset);
            var test = new ObservableDictionary <ObservableItem, ObservableItem>();

            test.ItemChanged += ObservableItemChanged;
            var key   = new ObservableItem();
            var value = new ObservableItem();

            test.Add(key, value);
            key.ReportChange();
            Assert.IsTrue(_handle.WaitOne(10), "The key is not detected as an observable");
            _handle.Reset();
            value.ReportChange();
            Assert.IsTrue(_handle.WaitOne(10), "The value is not detected as an observable");
        }
 public void NestedObservables()
 {
   _handle = new EventWaitHandle(false, EventResetMode.ManualReset);
   var test = new ObservableDictionary<ObservableItem, ObservableItem>();
   test.ItemChanged += ObservableItemChanged;
   var key = new ObservableItem();
   var value = new ObservableItem();
   test.Add(key, value);
   key.ReportChange();
   Assert.IsTrue(_handle.WaitOne(10), "The key is not detected as an observable");
   _handle.Reset();
   value.ReportChange();
   Assert.IsTrue(_handle.WaitOne(10), "The value is not detected as an observable");
 }
示例#4
0
 static void ObservableItemChanged(ICollection <ObservableItem> sender, ObservableItem item, EventArgs args)
 {
     _handle.Set();
 }
 public void NestedObservables()
 {
   _handle = new EventWaitHandle(false, EventResetMode.ManualReset);
   var test = new ObservableList<ObservableItem>();
   test.ItemChanged += ObservableItemChanged;
   var item = new ObservableItem();
   test.Add(item);
   item.ReportChange();
   Assert.IsTrue(_handle.WaitOne(10));
 }
 static void ObservableItemChanged(ICollection<ObservableItem> sender, ObservableItem item, EventArgs args)
 {
   _handle.Set();
 }