public async Task RemoveRange2()
        {
            var list = new SortedListReactiveCollectionSource <int>();

            var notificationTask = list.ReactiveCollection.Changes
                                   .Take(6)
                                   .ToArray()
                                   .ToTask();

            list.AddRange(new[] { 1, 2, 3, 4 });
            list.RemoveRange(2, 2);

            await Verify(notificationTask);
        }
Esempio n. 2
0
        public async Task RemoveRange()
        {
            var list = new SortedListReactiveCollectionSource <int>();

            var notificationsTask = list.ReactiveCollection.Changes
                                    .Skip(2)
                                    .Take(1)
                                    .ToArray()
                                    .ToTask();

            list.AddRange(new[] { 1, 2, 3, 4 });
            list.RemoveRange(new[] { 2, 4 });

            var notifications = await notificationsTask;

            notifications[0].Action.Should().Be(NotifyCollectionChangedAction.Reset);
            notifications[0].Current.Should().Equal(1, 3);
        }
Esempio n. 3
0
        public async Task RemoveRange2()
        {
            var list = new SortedListReactiveCollectionSource <int>();

            var notificationTask = list.ReactiveCollection.Changes
                                   .Skip(2)
                                   .FirstAsync()
                                   .ToTask();

            list.AddRange(new[] { 1, 2, 3, 4 });
            list.RemoveRange(2, 2);

            var notification = await notificationTask;

            notification.Action.Should().Be(NotifyCollectionChangedAction.Remove);
            notification.OldItems.Should().Equal(3, 4);
            notification.NewItems.Should().BeEmpty();
            notification.Current.Should().Equal(1, 2);
        }
        public async Task RemoveRange2()
        {
            var list = new SortedListReactiveCollectionSource<int>();

            var notificationTask = list.ReactiveCollection.Changes
                .Skip(2)
                .FirstAsync()
                .ToTask();

            list.AddRange(new[] { 1, 2, 3, 4 });
            list.RemoveRange(2, 2);

            var notification = await notificationTask;

            notification.Action.Should().Be(NotifyCollectionChangedAction.Remove);
            notification.OldItems.Should().Equal(3, 4);
            notification.NewItems.Should().BeEmpty();
            notification.Current.Should().Equal(1, 2);
        }
        public async Task RemoveRange()
        {
            var list = new SortedListReactiveCollectionSource<int>();

            var notificationsTask = list.ReactiveCollection.Changes
                .Skip(2)
                .Take(1)
                .ToArray()
                .ToTask();

            list.AddRange(new[] { 1, 2, 3, 4 });
            list.RemoveRange(new[] { 2, 4 });

            var notifications = await notificationsTask;

            notifications[0].Action.Should().Be(NotifyCollectionChangedAction.Reset);
            notifications[0].Current.Should().Equal(1, 3);
        }