Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DistinctValues is not working correctly for items that should be reinserted. #139

Closed
owoudenberg opened this issue Aug 17, 2018 · 0 comments
Labels

Comments

@owoudenberg
Copy link
Contributor

When using a DistinctValues on a collection where same values are removed and added again, then re-adding items are not notified in the resulting collection.

for example:

var collection = new ObservableCollection<int>();

using (collection.ToObservableChangeSet()
                 .DistinctValues(value => value)
                 .Bind(out var distinctCollection)
                 .Subscribe())
{
    collection.AddRange(new[] { 1, 1, 2, 3 });
    Assert.That(distinctCollection, Is.EquivalentTo(new[] { 1, 2, 3 }));
    collection.Remove(2);
    Assert.That(distinctCollection, Is.EquivalentTo(new[] { 1, 3 }));
    collection.Add(2);
    Assert.That(distinctCollection, Is.EquivalentTo(new[] { 1, 3, 2 })); // <-- this doesn't assert as distinctCollection now contains { 1, 3 }
}
@lock lock bot added the outdated label Jul 9, 2019
@lock lock bot locked and limited conversation to collaborators Jul 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants