Skip to content

HashSet in C#: modernize to .NET 10 and fix test defects - #2107

Closed
vladimir-pecanac-main wants to merge 1 commit into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/76166-hashset
Closed

HashSet in C#: modernize to .NET 10 and fix test defects#2107
vladimir-pecanac-main wants to merge 1 commit into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/76166-hashset

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Modernizes the HashSetInCSharp sample to .NET 10 and fixes three real test defects: LINQ Count() where the Count property is correct, reversed Assert.AreEqual argument order, and a non-deterministic RandomInts that could flake on hash collisions. Package versions bumped to current stable (MSTest 4.3.3, Microsoft.NET.Test.Sdk 18.9.0, coverlet.collector 10.0.1). Build clean, 12/12 tests pass on net10.0.

- Retarget both projects to net10.0
- Update MSTest to 4.3.3, Microsoft.NET.Test.Sdk to 18.9.0, coverlet.collector to 10.0.1
- Use the HashSet<T>/List<T> Count property instead of the LINQ Count() extension
- Correct reversed Assert.AreEqual(expected, actual) argument order
- Make RandomInts deterministic by filling the set to the requested size, so the union count assertion no longer flakes on hash collisions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant