public async Task RemoveRange() { var list = new DictionaryReactiveCollectionSource <string, int>(); var notificationsTask = list.ReactiveCollection.Changes .Skip(2) .Take(2) .ToArray() .ToTask(); list.AddRange(new[] { new KeyValuePair <string, int>("Key1", 1), new KeyValuePair <string, int>("Key2", 2), new KeyValuePair <string, int>("Key3", 3) }); list.RemoveRange(new[] { "Key1", "Key2" }); var notifications = await notificationsTask; notifications[0].Action.Should().Be(NotifyCollectionChangedAction.Remove); notifications[0].OldItems.Should().Equal(new KeyValuePair <string, int>("Key1", 1)); notifications[1].Action.Should().Be(NotifyCollectionChangedAction.Remove); notifications[1].OldItems.Should().Equal(new KeyValuePair <string, int>("Key2", 2)); notifications[1].Current.Should().Equal(new Dictionary <string, int> { { "Key3", 3 } }); }
public async Task RemoveRange() { var list = new DictionaryReactiveCollectionSource <string, int>(DeterministicStringKeyComparer.Instance); var notificationsTask = list.ReactiveCollection.Changes .Take(3) .ToArray() .ToTask(); list.AddRange(new[] { new KeyValuePair <string, int>("Key1", 1), new KeyValuePair <string, int>("Key2", 2), new KeyValuePair <string, int>("Key3", 3) }); list.RemoveRange(new[] { "Key1", "Key2" }); await Verify(notificationsTask); }
public async Task RemoveRange() { var list = new DictionaryReactiveCollectionSource<string, int>(); var notificationsTask = list.ReactiveCollection.Changes .Skip(2) .Take(2) .ToArray() .ToTask(); list.AddRange(new[] { new KeyValuePair<string, int>("Key1", 1), new KeyValuePair<string, int>("Key2", 2), new KeyValuePair<string, int>("Key3", 3) }); list.RemoveRange(new[] { "Key1", "Key2" }); var notifications = await notificationsTask; notifications[0].Action.Should().Be(NotifyCollectionChangedAction.Remove); notifications[0].OldItems.Should().Equal(new KeyValuePair<string, int>("Key1", 1)); notifications[1].Action.Should().Be(NotifyCollectionChangedAction.Remove); notifications[1].OldItems.Should().Equal(new KeyValuePair<string, int>("Key2", 2)); notifications[1].Current.Should().Equal(new Dictionary<string, int> { { "Key3", 3 } }); }