-
Notifications
You must be signed in to change notification settings - Fork 992
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
Add unit tests for LinkUtilities #12647
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are failing tests in the CI that need to be addressed.
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/LinkUtilitiesTests.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/LinkUtilitiesTests.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/LinkUtilitiesTests.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/LinkUtilitiesTests.cs
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #12647 +/- ##
====================================================
- Coverage 97.03492% 76.04500% -20.98992%
====================================================
Files 1182 3181 +1999
Lines 354561 639666 +285105
Branches 5411 47214 +41803
====================================================
+ Hits 344048 486434 +142386
- Misses 9724 149716 +139992
- Partials 789 3516 +2727
Flags with carried forward coverage won't be shown. Click here to find out more. |
public void LinkUtilities_GetIELinkBehavior_ReturnsExpected(string? registryValue, LinkBehavior expectedBehavior) | ||
{ | ||
// Set registry value if provided | ||
RegistryKey? key = Registry.CurrentUser.CreateSubKey(LinkUtilities.IEMainRegPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registry values are machine-wide singletons, multiple test cases might be accessing them at the same time. If we are changing these values, we have to move all tests that read and write them into a sequential collection. It will be hard to identify all tests that read these values behind the scenes. And we might miss that the future tests read this value going forward.
Instead of writing this key I would suggest to read it, and set the right expected LinkBehavior based on the key value.
related #10453
Proposed changes
Microsoft Reviewers: Open in CodeFlow