Esempio n. 1
0
        public void NoChangeNoEvent()
        {
            var change   = Diff.CollectionChange(new[] { 1, 2, 3 }, new[] { 1, 2, 3 });
            var notifier = new DummyNotifier();
            var actual   = notifier.SubscribeAll();

            Notifier.Notify(notifier, change, null, notifier.PropertyChangedEventHandler, notifier.NotifyCollectionChangedEventHandler);

            CollectionAssert.IsEmpty(actual);
        }
Esempio n. 2
0
        public void Remove(int index)
        {
            var before   = new[] { 1, 2, 3 };
            var ints     = new ObservableCollection <int>(before);
            var expected = ints.SubscribeAll();
            var notifier = new DummyNotifier();
            var actual   = notifier.SubscribeAll();

            ints.RemoveAt(index);
            var change = Diff.CollectionChange(before, ints);

            Notifier.Notify(notifier, change, null, notifier.PropertyChangedEventHandler, notifier.NotifyCollectionChangedEventHandler);

            CollectionAssert.AreEqual(expected, actual, EventArgsComparer.Default);
        }
Esempio n. 3
0
        public void AddToEmpty()
        {
            var ints     = new ObservableCollection <int>();
            var expected = ints.SubscribeAll();

            ints.Add(1);
            var notifier = new DummyNotifier();
            var actual   = notifier.SubscribeAll();

            var change = Diff.CollectionChange(new int[0], ints);

            Notifier.Notify(notifier, change, null, notifier.PropertyChangedEventHandler, notifier.NotifyCollectionChangedEventHandler);

            CollectionAssert.AreEqual(expected, actual, EventArgsComparer.Default);
        }