コード例 #1
0
        public async Task SetItems()
        {
            var list = new DictionaryReactiveCollectionSource <string, int>(DeterministicStringKeyComparer.Instance);

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

            list.AddRange(new[]
            {
                new KeyValuePair <string, int>("Key1", 1),
                new KeyValuePair <string, int>("Key2", 2),
                new KeyValuePair <string, int>("Key3", 3)
            });

            list.SetItems(new[]
            {
                new KeyValuePair <string, int>("Key1", 4),
                new KeyValuePair <string, int>("Key2", 5),
                new KeyValuePair <string, int>("Key3", 6)
            });

            await Verify(notificationTask);
        }
コード例 #2
0
        public async Task SetItems()
        {
            var list = new DictionaryReactiveCollectionSource <string, int>();

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

            list.AddRange(new[]
            {
                new KeyValuePair <string, int>("Key1", 1),
                new KeyValuePair <string, int>("Key2", 2),
                new KeyValuePair <string, int>("Key3", 3)
            });

            list.SetItems(new[]
            {
                new KeyValuePair <string, int>("Key1", 4),
                new KeyValuePair <string, int>("Key2", 5),
                new KeyValuePair <string, int>("Key3", 6)
            });

            var notification = await notificationTask;

            notification.Action.Should().Be(NotifyCollectionChangedAction.Reset);
            notification.Current.Should().Equal(new Dictionary <string, int>
            {
                { "Key1", 4 },
                { "Key2", 5 },
                { "Key3", 6 }
            });
        }
        public async Task SetItems()
        {
            var list = new DictionaryReactiveCollectionSource<string, int>();

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

            list.AddRange(new[]
            {
                new KeyValuePair<string, int>("Key1", 1),
                new KeyValuePair<string, int>("Key2", 2),
                new KeyValuePair<string, int>("Key3", 3)
            });

            list.SetItems(new[]
            {
                new KeyValuePair<string, int>("Key1", 4),
                new KeyValuePair<string, int>("Key2", 5),
                new KeyValuePair<string, int>("Key3", 6)
            });

            var notification = await notificationTask;

            notification.Action.Should().Be(NotifyCollectionChangedAction.Reset);
            notification.Current.Should().Equal(new Dictionary<string, int>
            {
                { "Key1", 4 },
                { "Key2", 5 },
                { "Key3", 6 }
            });
        }