Beispiel #1
0
        public async Task Clear_preserves_comparer()
        {
            var list = new SortedSetReactiveCollectionSource <StructNotImplementingIComparable>(new Comparison <StructNotImplementingIComparable>((x, y) => x.Value.CompareTo(y.Value)).ToComparer());

            list.Add(new StructNotImplementingIComparable(1));
            list.Clear();
            list.Add(new StructNotImplementingIComparable(2));
            list.Add(new StructNotImplementingIComparable(1));

            var current = (await list.ReactiveCollection.Changes.FirstAsync()).Current.Select(x => x.Value).ToArray();

            current.Should().Equal(1, 2);
        }
Beispiel #2
0
        public async Task Clear()
        {
            var list = new SortedSetReactiveCollectionSource <int>();

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

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

            await Verify(notificationsTask);
        }
Beispiel #3
0
        public async Task Clear_preserves_comparer()
        {
            var list = new SortedSetReactiveCollectionSource <StructNotImplementingIComparable>(new Comparison <StructNotImplementingIComparable>((x, y) => x.Value.CompareTo(y.Value)).ToComparer());

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

            list.Add(new StructNotImplementingIComparable(1));
            list.Clear();
            list.Add(new StructNotImplementingIComparable(2));
            list.Add(new StructNotImplementingIComparable(1));

            await Verify(notificationsTask);
        }
Beispiel #4
0
        public async Task Clear()
        {
            var list = new SortedSetReactiveCollectionSource <int>();

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

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

            var notification = await notificationTask;

            notification.Action.Should().Be(NotifyCollectionChangedAction.Reset);
            notification.NewItems.Should().BeEmpty();
            notification.OldItems.Should().BeEmpty();
            notification.Current.Should().BeEmpty();
        }
        public async Task Clear()
        {
            var list = new SortedSetReactiveCollectionSource<int>();

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

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

            var notification = await notificationTask;

            notification.Action.Should().Be(NotifyCollectionChangedAction.Reset);
            notification.NewItems.Should().BeEmpty();
            notification.OldItems.Should().BeEmpty();
            notification.Current.Should().BeEmpty();
        }
        public async Task Clear_preserves_comparer()
        {
            var list = new SortedSetReactiveCollectionSource<StructNotImplementingIComparable>(new Comparison<StructNotImplementingIComparable>((x, y) => x.Value.CompareTo(y.Value)).ToComparer());

            list.Add(new StructNotImplementingIComparable(1));
            list.Clear();
            list.Add(new StructNotImplementingIComparable(2));
            list.Add(new StructNotImplementingIComparable(1));

            var current = (await list.ReactiveCollection.Changes.FirstAsync()).Current.Select(x => x.Value).ToArray();

            current.Should().Equal(1, 2);
        }