Skip to content

[repo-assist] test: add coverage for implicit operators, parts constructor, overflow guards, and edge cases#20

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
repo-assist/test-coverage-2026-06-ec23baaa3e2d14aa
Draft

[repo-assist] test: add coverage for implicit operators, parts constructor, overflow guards, and edge cases#20
github-actions[bot] wants to merge 1 commit into
mainfrom
repo-assist/test-coverage-2026-06-ec23baaa3e2d14aa

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This pull request was created by Repo Assist, an automated AI assistant.

Summary

Adds 15 new tests covering previously untested paths in DateTimeNano, bringing the total to 55 tests (was 40).

What's covered by the new tests

Area Tests added
Parts constructor Constructor_Parts_ShouldCreateCorrectValue, Constructor_Parts_DefaultsToMidnight
Local DateTime → UTC Constructor_LocalDateTime_ShouldConvertToUtc
Date property Date_Property_ShouldReturnMidnight
AddNanoseconds overflow AddNanoseconds_ShouldThrow_WhenPositiveOverflow
AddMonths/AddYears negative AddMonths_Negative_ShouldDecreaseCorrectly, AddYears_Negative_ShouldDecreaseCorrectly
Equals(object?) override Equal value, null, wrong type
Implicit conversion operators DateTimeNano → DateTime, DateTime → DateTimeNano
ISO 8601 T separator TryParse_WithTSeparator_ShouldSucceed, Parse_WithTSeparator_ShouldSucceed
Subtract overflow Subtract_ShouldThrow_WhenDifferenceExceedsLongMaxValue

Why

These paths existed and worked correctly but had no automated verification. The additions:

  • Guard against regressions in the local-to-UTC conversion path.
  • Verify that the implicit operators (DateTime ↔ DateTimeNano) behave as documented.
  • Confirm that overflow/underflow guards throw the right exceptions.
  • Confirm ISO 8601 T-separator strings are accepted by TryParse/Parse.

No production code was changed.

Test Status

✅ All 55 tests pass on net8.0. Build succeeded for net8.0, net9.0, and net10.0 with 0 warnings.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

…w guards, and edge cases

- Add tests for implicit DateTime ↔ DateTimeNano conversion operators
- Add tests for the parts constructor (year, month, day, ...) directly
- Add test for local DateTime → UTC conversion in constructor
- Add test for Date property returning midnight
- Add test for AddNanoseconds positive overflow guard
- Add tests for AddMonths/AddYears with negative values
- Add tests for Equals(object?) override (null, wrong type, equal)
- Add tests for TryParse/Parse with ISO 8601 T separator
- Add test for Subtract OverflowException on >292-year gap

Total: 55 tests (was 40)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants