コード例 #1
0
        public void when_ClearAsync_is_called_and_IsNotifying_is_false_then_Reset_event_is_fired()
        {
            var testSchedulerProvider = new TestDispatcherSchedulerProvider();

            var result = false;

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

            var newGuid = Guid.NewGuid();

            bindableCollection.Add(newGuid);

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

            bindableCollection.IsNotifying = false;

            bindableCollection.ClearAsync();

            Assert.That(result, Is.False);
        }
コード例 #2
0
        public void when_ClearAsync_is_called_then_Reset_event_is_fired()
        {
            var testSchedulerProvider = new TestDispatcherSchedulerProvider();

            var result = false;

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

            var newGuid = Guid.NewGuid();

            bindableCollection.Add(newGuid);

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

            bindableCollection.ClearAsync();

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