-
Notifications
You must be signed in to change notification settings - Fork 279
Fix TypeContainingTestMethodShouldBeATestClassAnalyzer to handle structs with TestMethod #5818
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
Conversation
Try agian please |
Fix issues |
I've analyzed the codebase and the changes made. The analyzer logic looks correct - it now properly handles both classes and structs with test methods. However, I'm unable to build the project due to SDK version requirements and network connectivity issues preventing package downloads. Could you provide more details about what specific issues need to be fixed? Are they build errors, test failures, or something else? Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Please fix issues |
Fixed the issues in commit d0f9c9a:
The analyzer now properly handles both classes and structs with consistent messaging across all supported languages. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
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.
[TestClass]
cannot be set on struct
, please update the codefix to also offer changing struct
to class
.
Fixed in commit dd4a6fc. The codefix now properly handles structs by changing them to classes and adding the |
Code fixer won't work for |
Fixed in commit ded9805. The code fixer now properly handles Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5818 +/- ##
==========================================
+ Coverage 73.23% 75.74% +2.51%
==========================================
Files 615 615
Lines 37642 37712 +70
==========================================
+ Hits 27568 28566 +998
+ Misses 10074 9146 -928
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
…pe" instead of "Class" Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
…est methods Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
…record classes Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
…keyword with class keyword Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
6e84f01
to
22faec7
Compare
Description
Fixes #5621 - The
TypeContainingTestMethodShouldBeATestClassAnalyzer
was not triggering warnings for structs containing[TestMethod]
attributes.Problem
Previously, the analyzer only checked classes for test methods, meaning this code would not produce any warning:
This was problematic because test methods in structs without the
[TestClass]
attribute are silently ignored by the test framework.Solution
Changes Made
TypeKind.Class
only toTypeKind.Class && TypeKind.Struct
Verification
The fix ensures that:
[TestMethod]
now trigger the analyzer warningFixes #5621
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
5rqvsblobprodcus385.vsblob.vsassets.io
/home/REDACTED/work/testfx/testfx/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/testfx/testfx/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/testfx/testfx/artifacts/toolset/10.0.0-beta.25316.2.txt
(dns block)dotnet build src/Analyzers/MSTest.Analyzers/MSTest.Analyzers.csproj --verbosity minimal
(dns block)dotnet test test/UnitTests/MSTest.Analyzers.UnitTests/MSTest.Analyzers.UnitTests.csproj --filter TypeContainingTestMethod --verbosity minimal
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.