style: idiomatic cleanups in mid-size test files - #421
Merged
Conversation
Convert == null / != null guard clauses to is null / is not null in non-assertion helper code across TestPublicApiRobustness.cs, TestPhoneNumberProperties.cs, and TestExampleNumbers.cs. No assertion logic, test data, or expected values touched.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #421 +/- ##
=======================================
Coverage 87.42% 87.42%
=======================================
Files 41 41
Lines 3856 3856
Branches 990 990
=======================================
Hits 3371 3371
Misses 283 283
Partials 202 202 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Aug 28, 2026
Closed
Open
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of the ongoing idiomatic-C# cleanup sweep (see #409, #412-#419). Very conservative pass over 10 mid-size files in
PhoneNumbers.Test/:TestBuildMetadataFromXml.cs,TestShortNumberInfo.cs,TestPhoneNumberToCarrierMapper.cs,TestPhoneNumberToTimeZonesMapper.cs,TestPublicApiRobustness.cs,TestPhoneNumberOfflineGeocoder.cs,TestAreaCodeMap.cs,TestPhoneNumberProperties.cs,TestBuildPrefixMapFromBin.cs,TestExampleNumbers.cs.Most of these are near line-by-line ports of upstream Google Java test suites, so this PR intentionally only touches non-assertion helper/setup code — no assertion logic, test data, expected values, or method structure changed. Only 3 files had anything to change:
TestPublicApiRobustness.cs,TestPhoneNumberProperties.cs,TestExampleNumbers.cs:== null/!= nullguard clauses →is null/is not null.The other 7 files were reviewed and left untouched — nothing outside an
Assert.*call was a safe, unambiguous win.Test plan
dotnet build csharp/PhoneNumbers.slnx— 0 warnings, 0 errorsdotnet test csharp/PhoneNumbers.Test/PhoneNumbers.Test.csproj— 414/414 passing on net8.0 and net10.0 (same count as before)