π― Repository Quality Improvement Report β New Assert API Analyzer Coverage
Analysis Date: 2026-05-18
Focus Area: New Collection Assert API β Analyzer Guidance and Documentation Completeness
Strategy Type: Custom (repository-specific)
Executive Summary
MSTest's Assert class has gained a rich set of new collection-oriented APIs β AreAllDistinct, AreAllNotNull, AreAllOfType, ContainsAll, DoesNotContainAll, AreEquivalent, AreNotEquivalent (22 entries in PublicAPI.Unshipped.txt) β which represent a major quality-of-life improvement for test authors. However, the UseProperAssertMethodsAnalyzer (MSTEST0037), which guides developers toward these better assertion methods, does not yet cover the new APIs. This means users writing verbose Assert.IsTrue(...) workarounds for collection-wide checks miss out on automated guidance toward the cleaner, more descriptive new methods.
Additionally, the main analyzer file UseProperAssertMethodsAnalyzer.cs has grown to 1 567 lines β by far the largest non-test source file β and warrants structural review. Closing the gap between the new APIs and the analyzer that promotes them will maximize the discoverability and adoption of these improvements.
Full Analysis Report
Focus Area: New Collection Assert API β Analyzer Guidance and Documentation Completeness
Current State Assessment
Metrics Collected:
| Metric |
Value |
Status |
| New public API entries (Unshipped) |
22 |
β οΈ Needs analyzer coverage |
UseProperAssertMethodsAnalyzer.cs lines |
1 567 |
β οΈ Oversized, hard to maintain |
Analyzer files in MSTest.Analyzers/ |
59 |
β
Healthy set |
| TODO/FIXME comments (source) |
75 |
β οΈ Review for actionability |
| Test-to-source file ratio |
583 / 2 281 β 26 % |
β οΈ Moderate coverage |
Findings
Strengths
UseProperAssertMethodsAnalyzer (MSTEST0037) already guides toward IsNull, AreEqual, IsFalse, IsEmpty, ContainsSingle, Contains, comparison operators, and LINQ .Any() / .Count() β excellent baseline.
- New Assert collection APIs are well-documented inline (every public method has XML
<summary> in source).
- Analyzer suite is active and growing (MSTEST0058βMSTEST0063 added recently).
Areas for Improvement
- [High] MSTEST0037 does not yet suggest
AreAllDistinct, ContainsAll, DoesNotContainAll, AreAllNotNull, AreAllOfType, AreEquivalent / AreNotEquivalent for common verbose patterns.
- [Medium]
UseProperAssertMethodsAnalyzer.cs is 1 567 lines; difficult to navigate and review. Similar refactoring was done for other large analyzers.
- [Medium] No dedicated documentation page exists in
docs/ for the new collection assertion APIs (only docs/Changelog.md entries).
- [Low] 75 TODO/FIXME comments in source β periodic triage would catch stale items.
π€ Suggested Improvement Tasks
Task 1: Extend MSTEST0037 to cover new collection assertion methods
Priority: High
Estimated Effort: Medium
The UseProperAssertMethodsAnalyzer should detect patterns such as:
| Verbose pattern |
Suggested replacement |
Assert.IsTrue(collection.Distinct().SequenceEqual(collection)) |
Assert.AreAllDistinct(collection) |
Assert.IsTrue(expected.All(x => collection.Contains(x))) |
Assert.ContainsAll(expected, collection) |
Assert.IsTrue(collection.All(x => x != null)) |
Assert.AreAllNotNull(collection) |
Assert.IsTrue(collection.All(x => x is T)) |
Assert.AreAllOfType<T>(collection) |
Files to modify:
src/Analyzers/MSTest.Analyzers/UseProperAssertMethodsAnalyzer.cs
src/Analyzers/MSTest.Analyzers.CodeFixes/UseProperAssertMethodsAnalyzerFixer.cs
src/Analyzers/MSTest.Analyzers/Resources.resx (new message strings; build to regenerate .xlf)
- Corresponding test file in
test/UnitTests/MSTest.Analyzers.UnitTests/
Task 2: Split UseProperAssertMethodsAnalyzer.cs into focused partial-class files
Priority: Medium
Estimated Effort: Medium
At 1 567 lines, UseProperAssertMethodsAnalyzer.cs is the largest source file in the repository and handles many independent detection scenarios. Refactor it into partial-class files grouped by assertion category (null checks, equality, collection membership, comparison, string), following the same pattern used in the Assert source files (Assert.Contains.cs, Assert.AreEqual.cs, etc.).
Suggested split:
UseProperAssertMethodsAnalyzer.NullChecks.cs
UseProperAssertMethodsAnalyzer.Equality.cs
UseProperAssertMethodsAnalyzer.Collection.cs
UseProperAssertMethodsAnalyzer.Comparison.cs
UseProperAssertMethodsAnalyzer.String.cs
Files to modify:
src/Analyzers/MSTest.Analyzers/UseProperAssertMethodsAnalyzer.cs (keep shared declarations)
Task 3: Add a documentation page for the new collection assertion APIs
Priority: Medium
Estimated Effort: Small
Create docs/assert-collection-apis.md summarising the new collection-oriented Assert methods added in v4.x (AreAllDistinct, AreAllNotNull, AreAllOfType, ContainsAll, DoesNotContainAll, AreEquivalent, AreNotEquivalent, IsInRange). Include:
- Purpose and when to use each method over
CollectionAssert equivalents.
- Code examples.
- Migration guide from
Assert.IsTrue(LINQ expression) patterns.
Link the new page from README.md and docs/Changelog.md.
Task 4: Triage and resolve actionable TODO/FIXME comments
Priority: Low
Estimated Effort: Small
75 TODO/FIXME/HACK comments exist across the codebase. Run a triage pass to:
- Convert actionable items into tracked issues.
- Remove comments that are no longer relevant.
- Add links to existing issues for those already tracked.
grep -rn "TODO\|FIXME\|HACK" --include="*.cs" src/ | grep -v obj/ | grep -v bin/
π Historical Context
Previous Focus Areas
| Date |
Focus Area |
Type |
| 2026-05-18 |
New Assert API Analyzer Coverage |
Custom |
π― Recommendations
Immediate Actions (This Week)
- Extend MSTEST0037 for
AreAllNotNull and ContainsAll β these have the clearest LINQ analogs and highest user impact. Priority: High.
Short-term Actions (This Month)
- Split
UseProperAssertMethodsAnalyzer.cs into partial-class files β improves long-term maintainability. Priority: Medium.
- Add collection API documentation page β increases feature discoverability for users upgrading to v4.x. Priority: Medium.
- TODO triage β 15-minute clean-up pass. Priority: Low.
Generated by Repository Quality Improvement Agent
Next analysis: 2026-05-19 β Focus area selected based on diversity algorithm (custom/standard/reuse strategy)
Generated by Repository Quality Improver Β· β 3.9M Β· β·
π― Repository Quality Improvement Report β New Assert API Analyzer Coverage
Analysis Date: 2026-05-18
Focus Area: New Collection Assert API β Analyzer Guidance and Documentation Completeness
Strategy Type: Custom (repository-specific)
Executive Summary
MSTest's
Assertclass has gained a rich set of new collection-oriented APIs βAreAllDistinct,AreAllNotNull,AreAllOfType,ContainsAll,DoesNotContainAll,AreEquivalent,AreNotEquivalent(22 entries inPublicAPI.Unshipped.txt) β which represent a major quality-of-life improvement for test authors. However, theUseProperAssertMethodsAnalyzer(MSTEST0037), which guides developers toward these better assertion methods, does not yet cover the new APIs. This means users writing verboseAssert.IsTrue(...)workarounds for collection-wide checks miss out on automated guidance toward the cleaner, more descriptive new methods.Additionally, the main analyzer file
UseProperAssertMethodsAnalyzer.cshas grown to 1 567 lines β by far the largest non-test source file β and warrants structural review. Closing the gap between the new APIs and the analyzer that promotes them will maximize the discoverability and adoption of these improvements.Full Analysis Report
Focus Area: New Collection Assert API β Analyzer Guidance and Documentation Completeness
Current State Assessment
Metrics Collected:
UseProperAssertMethodsAnalyzer.cslinesMSTest.Analyzers/Findings
Strengths
UseProperAssertMethodsAnalyzer(MSTEST0037) already guides towardIsNull,AreEqual,IsFalse,IsEmpty,ContainsSingle,Contains, comparison operators, and LINQ.Any()/.Count()β excellent baseline.<summary>in source).Areas for Improvement
AreAllDistinct,ContainsAll,DoesNotContainAll,AreAllNotNull,AreAllOfType,AreEquivalent/AreNotEquivalentfor common verbose patterns.UseProperAssertMethodsAnalyzer.csis 1 567 lines; difficult to navigate and review. Similar refactoring was done for other large analyzers.docs/for the new collection assertion APIs (onlydocs/Changelog.mdentries).π€ Suggested Improvement Tasks
Task 1: Extend MSTEST0037 to cover new collection assertion methods
Priority: High
Estimated Effort: Medium
The
UseProperAssertMethodsAnalyzershould detect patterns such as:Assert.IsTrue(collection.Distinct().SequenceEqual(collection))Assert.AreAllDistinct(collection)Assert.IsTrue(expected.All(x => collection.Contains(x)))Assert.ContainsAll(expected, collection)Assert.IsTrue(collection.All(x => x != null))Assert.AreAllNotNull(collection)Assert.IsTrue(collection.All(x => x is T))Assert.AreAllOfType<T>(collection)Files to modify:
src/Analyzers/MSTest.Analyzers/UseProperAssertMethodsAnalyzer.cssrc/Analyzers/MSTest.Analyzers.CodeFixes/UseProperAssertMethodsAnalyzerFixer.cssrc/Analyzers/MSTest.Analyzers/Resources.resx(new message strings; build to regenerate.xlf)test/UnitTests/MSTest.Analyzers.UnitTests/Task 2: Split
UseProperAssertMethodsAnalyzer.csinto focused partial-class filesPriority: Medium
Estimated Effort: Medium
At 1 567 lines,
UseProperAssertMethodsAnalyzer.csis the largest source file in the repository and handles many independent detection scenarios. Refactor it into partial-class files grouped by assertion category (null checks, equality, collection membership, comparison, string), following the same pattern used in the Assert source files (Assert.Contains.cs,Assert.AreEqual.cs, etc.).Suggested split:
UseProperAssertMethodsAnalyzer.NullChecks.csUseProperAssertMethodsAnalyzer.Equality.csUseProperAssertMethodsAnalyzer.Collection.csUseProperAssertMethodsAnalyzer.Comparison.csUseProperAssertMethodsAnalyzer.String.csFiles to modify:
src/Analyzers/MSTest.Analyzers/UseProperAssertMethodsAnalyzer.cs(keep shared declarations)Task 3: Add a documentation page for the new collection assertion APIs
Priority: Medium
Estimated Effort: Small
Create
docs/assert-collection-apis.mdsummarising the new collection-oriented Assert methods added in v4.x (AreAllDistinct,AreAllNotNull,AreAllOfType,ContainsAll,DoesNotContainAll,AreEquivalent,AreNotEquivalent,IsInRange). Include:CollectionAssertequivalents.Assert.IsTrue(LINQ expression)patterns.Link the new page from
README.mdanddocs/Changelog.md.Task 4: Triage and resolve actionable TODO/FIXME comments
Priority: Low
Estimated Effort: Small
75
TODO/FIXME/HACKcomments exist across the codebase. Run a triage pass to:π Historical Context
Previous Focus Areas
π― Recommendations
Immediate Actions (This Week)
AreAllNotNullandContainsAllβ these have the clearest LINQ analogs and highest user impact. Priority: High.Short-term Actions (This Month)
UseProperAssertMethodsAnalyzer.csinto partial-class files β improves long-term maintainability. Priority: Medium.Generated by Repository Quality Improvement Agent
Next analysis: 2026-05-19 β Focus area selected based on diversity algorithm (custom/standard/reuse strategy)