Exemplo n.º 1
0
        public void ClearSource()
        {
            var ints = new ObservableCollection <int>(new[] { 1, 2, 3 });
            var view = new ReadOnlySerialView <int>(ints);

            var changes = view.SubscribeAll();

            view.ClearSource();
            CollectionAssert.IsEmpty(view);
            CollectionAssert.AreEqual(Diff.ResetEventArgsCollection, changes, EventArgsComparer.Default);
        }
        public static void ClearSource()
        {
            var source = new ObservableCollection <int> {
                1, 2, 3
            };

            using var view   = new ReadOnlySerialView <int>(source);
            using var actual = view.SubscribeAll();
            view.ClearSource();
            CollectionAssert.IsEmpty(view);
            var expected = new EventArgs[]
            {
                CachedEventArgs.CountPropertyChanged,
                CachedEventArgs.IndexerPropertyChanged,
                CachedEventArgs.NotifyCollectionReset,
                CachedEventArgs.GetOrCreatePropertyChangedEventArgs("Source"),
            };

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