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

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

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

            await Verify(notificationsTask);
        }
コード例 #2
0
        public async Task Replace()
        {
            var list = new SortedListReactiveCollectionSource <int>();

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

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

            var notifications = await notificationsTask;

            notifications[0].Action.Should().Be(NotifyCollectionChangedAction.Remove);
            notifications[0].OldItems.Should().Equal(1);
            notifications[1].Action.Should().Be(NotifyCollectionChangedAction.Add);
            notifications[1].NewItems.Should().Equal(5);
            notifications[1].Current.Should().Equal(1, 2, 3, 4, 5);
        }
        public async Task Replace()
        {
            var list = new SortedListReactiveCollectionSource<int>();

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

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

            var notifications = await notificationsTask;

            notifications[0].Action.Should().Be(NotifyCollectionChangedAction.Remove);
            notifications[0].OldItems.Should().Equal(1);
            notifications[1].Action.Should().Be(NotifyCollectionChangedAction.Add);
            notifications[1].NewItems.Should().Equal(5);
            notifications[1].Current.Should().Equal(1, 2, 3, 4, 5);
        }