| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Co-authored-by: jnyrup <919634+jnyrup@users.noreply.github.com>
Test Results 37 files ± 0 37 suites ±0 6m 26s ⏱️ -23s Results for commit eee7305. ± Comparison against base commit 27bd2f9. This pull request removes 10 and adds 20 tests. Note that renamed tests count towards both.FluentAssertions.Specs.Streams.StreamAssertionSpecs+HaveLength ‑ When_a_throwing_stream_should_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. FluentAssertions.Specs.Streams.StreamAssertionSpecs+HaveLength ‑ When_a_throwing_stream_should_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. FluentAssertions.Specs.Streams.StreamAssertionSpecs+HavePosition ‑ When_a_throwing_stream_should_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. FluentAssertions.Specs.Streams.StreamAssertionSpecs+HavePosition ‑ When_a_throwing_stream_should_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHaveLength ‑ When_a_throwing_stream_should_not_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHaveLength ‑ When_a_throwing_stream_should_not_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHavePosition ‑ When_a_throwing_stream_should_not_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHavePosition ‑ When_a_throwing_stream_should_not_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'GetLengthExceptionMessage'.) Object name: 'GetPositionExceptionMessage'.) FluentAssertions.Specs.Primitives.DateTimeAssertionSpecs+HaveMillisecond ‑ Fails_for_datetime_with_different_milliseconds FluentAssertions.Specs.Primitives.DateTimeAssertionSpecs+HaveMillisecond ‑ Fails_for_null_datetime FluentAssertions.Specs.Primitives.DateTimeAssertionSpecs+HaveMillisecond ‑ Succeeds_for_datetime_with_the_same_milliseconds FluentAssertions.Specs.Primitives.DateTimeAssertionSpecs+NotHaveMillisecond ‑ Fails_for_datetime_with_the_same_milliseconds FluentAssertions.Specs.Primitives.DateTimeAssertionSpecs+NotHaveMillisecond ‑ Fails_for_null_datetime FluentAssertions.Specs.Primitives.DateTimeAssertionSpecs+NotHaveMillisecond ‑ Succeeds_for_datetime_with_different_milliseconds FluentAssertions.Specs.Primitives.DateTimeOffsetAssertionSpecs+HaveMillisecond ‑ Fails_for_datetimeoffset_with_different_milliseconds FluentAssertions.Specs.Primitives.DateTimeOffsetAssertionSpecs+HaveMillisecond ‑ Fails_for_null_datetimeoffset FluentAssertions.Specs.Primitives.DateTimeOffsetAssertionSpecs+HaveMillisecond ‑ Succeeds_for_datetimeoffset_with_the_same_milliseconds FluentAssertions.Specs.Primitives.DateTimeOffsetAssertionSpecs+NotHaveMillisecond ‑ Fails_for_datetimeoffset_with_the_same_milliseconds … ♻️ This comment has been updated with latest results. |
Sorry, something went wrong.
Qodana for .NETIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact us at qodana-support@jetbrains.com
|
Sorry, something went wrong.
There was a problem hiding this comment.
@copilot please address the following points:
Sorry, something went wrong.
@copilot apply the requested changes |
Sorry, something went wrong.
…nges Co-authored-by: dennisdoomen <572734+dennisdoomen@users.noreply.github.com>
All requested changes have been applied in commit fcb2dfc:
All tests pass: 18 HaveMillisecond tests, 4 approval tests, and no regressions in existing DateTime/DateTimeOffset tests. |
Sorry, something went wrong.
Pull Request Test Coverage Report for Build 22803252634Details
💛 - Coveralls |
Sorry, something went wrong.
Co-authored-by: dennisdoomen <572734+dennisdoomen@users.noreply.github.com>
| Back | FazBrowse Home | New Git URL |
Implementation Complete ✓
Summary
Successfully implemented HaveMillisecond and NotHaveMillisecond assertion methods for both DateTime and DateTimeOffset types, following the existing patterns. All tests pass successfully with no regressions detected. Test naming has been refined to follow clean naming conventions without rigid and noisy words.
Original promptThis section details on the original issue you should resolve
<issue_title>Method to assert the millisecond part of a DateTime / DateTimeOffset instance</issue_title>
<issue_description>### Background and motivation
Currently, FluentAssertions has methods to assert the year, month, day, hour, minute, second and offset of a DateTimeOffset (HaveX), but an equivalent method for the millisecond part is missing. Generally, it would be nice to assert the millisecond part in the style of FluentAssertions instead of using result.Millisecond.Should().Be(milliseconds).
I'm currently working on a library that provides convenience methods based on DateTime/DateTimeOffset and implement date and time related unit tests for it.
This is very easy to implement, because we can extend the DateTimeAssertions class and DateTimeOffsetAssertions class by a method called HaveMillisecond.
The implementation of this method could look like following:
Also the opponent of HaveMillisecond, which would be NotHaveMillisecond, can be implemented this way by inverting / changing the condition to this.Subject!.Value.Millisecond != expectedMilliseconds.
API Proposal
API Usage
Alternative Designs
Alternately, you could write an extension method based on DateTimeOffsetAssertions class and add there the HaveMillisecond method. This would not directly change the API of FluentAssertions, but would not be consistent with the rest of the DateTime/DateTimeOffset method provided by FluentAssertions.
The extension method could be implemented like following:
Risks
None, because it adds an extra method to assert the millisecond part of a DateTime / DateTimeOffset instance.
Are you willing to help with a proof-of-concept (as PR in that or a separate repo) first and as pull-request later on?
Yes, please assign this issue to me.</issue_description>
Comments on the Issue (you are @copilot ...
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.