Skip to content

refactor(tests): make string assertions and searches comparison-explicit (CA1307, CA1310) - #162

Merged
DeepDiver1975 merged 1 commit into
mainfrom
fix/analyzer-string-comparison
Aug 30, 2026
Merged

refactor(tests): make string assertions and searches comparison-explicit (CA1307, CA1310)#162
DeepDiver1975 merged 1 commit into
mainfrom
fix/analyzer-string-comparison

Conversation

@DeepDiver1975

Copy link
Copy Markdown
Collaborator

Adds an explicit StringComparison.Ordinal to all 51 flagged call sites (98 CA1307 + 6 CA1310 warnings). Every site is in a test project — production code was already comparison-explicit.

  • 46 string assertions: xUnit Assert.Contains/StartsWith/EndsWith/DoesNotContain(string, string?) now pass StringComparison.Ordinal.
  • 5 string search calls: string.Contains(string|char) / string.StartsWith(string) in test helpers get an explicit ordinal comparison.
  • Chose Ordinal (deterministic, culture-free) over CurrentCulture — the matched strings are exact German UI/log fragments; the full suite still passes 801/1, confirming no assertion relied on culture-linguistic collapsing.
  • Verification: CA1307 and CA1310 at 0 under AnalysisMode=All, zero errors, no change to any other rule; full suite 801 passed / 1 skipped.

…cit (CA1307, CA1310)

Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
@DeepDiver1975
DeepDiver1975 force-pushed the fix/analyzer-string-comparison branch from 0b0e686 to 6e7046a Compare August 30, 2026 21:16
@DeepDiver1975
DeepDiver1975 merged commit 37dae99 into main Aug 30, 2026
3 of 4 checks passed
@DeepDiver1975
DeepDiver1975 deleted the fix/analyzer-string-comparison branch August 30, 2026 21:48
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