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

            var notificationsTask = list.ReactiveCollection.Changes
                                    .Take(4)
                                    .ToArray()
                                    .FirstAsync()
                                    .ToTask();

            list.Add(1);
            list.Add(2);
            list.RemoveAt(1);

            await Verify(notificationsTask);
        }
        public void Item()
        {
            var list = new SortedListReactiveCollectionSource <int>();

            list.Add(1);

            list[0].Should().Be(1);
        }
Esempio n. 3
0
        public async Task RemoveAt()
        {
            var list = new SortedListReactiveCollectionSource <int>();

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

            list.Add(1);
            list.Add(2);
            list.RemoveAt(1);

            var notification = await notificationTask;

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

            var notificationsTask = list.ReactiveCollection.Changes
                                    .Take(3)
                                    .ToArray()
                                    .ToTask();

            list.Add(1);
            list.Clear();

            await Verify(notificationsTask);
        }
        public async Task Add()
        {
            var list = new SortedListReactiveCollectionSource<int>();

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

            list.Add(1);

            var notification = await notificationTask;

            notification.Index.Should().Be(0);
            notification.Action.Should().Be(NotifyCollectionChangedAction.Add);
            notification.NewItems.Should().Equal(1);
            notification.OldItems.Should().BeEmpty();
            notification.Current.Should().Equal(1);
        }
Esempio n. 6
0
        public async Task Clear()
        {
            var list = new SortedListReactiveCollectionSource <int>();

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

            list.Add(1);
            list.Clear();

            var notification = await notificationTask;

            notification.Index.Should().NotHaveValue();
            notification.Action.Should().Be(NotifyCollectionChangedAction.Reset);
            notification.NewItems.Should().BeEmpty();
            notification.OldItems.Should().BeEmpty();
            notification.Current.Should().BeEmpty();
        }
        public void Item()
        {
            var list = new SortedListReactiveCollectionSource<int>();
            list.Add(1);

            list[0].Should().Be(1);
        }