Example #1
0
        public void when_RefreshAsync_is_called_and_IsNotifying_is_false_then_Reset_event_fired()
        {
            var testSchedulerProvider = new TestDispatcherSchedulerProvider();

            var result = false;

            var bindableCollection = new BindableCollection <int>(testSchedulerProvider);

            var items = Enumerable.Range(0, 1).ToList();

            bindableCollection.AddRange(items);

            bindableCollection.CollectionChanged += (sender, args) =>
            {
                if (args.Action == NotifyCollectionChangedAction.Reset)
                {
                    result = true;
                }
            };

            bindableCollection.IsNotifying = false;

            bindableCollection.RefreshAsync();

            Assert.That(result, Is.False);
        }
Example #2
0
        public void when_RefreshAsync_is_called_then_Reset_event_fired()
        {
            var testSchedulerProvider = new TestDispatcherSchedulerProvider();

            var result = false;

            var bindableCollection = new BindableCollection<int>(testSchedulerProvider);

            var items = Enumerable.Range(0, 1).ToList();

            bindableCollection.AddRange(items);

            bindableCollection.CollectionChanged += (sender, args) =>
                                                    {
                                                        if (args.Action == NotifyCollectionChangedAction.Reset)
                                                        {
                                                            result = true;
                                                        }
                                                    };

            bindableCollection.RefreshAsync();

            Assert.That(result, Is.True);
        }