Skip to content
New issue

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

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

Already on GitHub? # to your account

Exception during adding an item may leave the item "partially" added #41

Closed
akade opened this issue Jun 7, 2023 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@akade
Copy link
Owner

akade commented Jun 7, 2023

If an item that has a non-unique key, it results in "partial adds".

The following test fails as 3 is added to the set even though it should not have been as it is not indexed.

IndexedSet<int> set = IndexedSetBuilder<int>.Create()
                                                                        .WithUniqueIndex(x => x / 2)
                                                                        .Build();

set.Add(2);
Assert.ThrowsException<ArgumentException>(() => set.Add(3));
Assert.IsFalse(set.Contains(3));
@akade akade added the bug Something isn't working label Jun 15, 2023
@akade akade closed this as completed in 5236ee4 Jul 11, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant