Add assertions for net6.0 DateOnly/TimeOnly
See original GitHub issueDescription
.NET 6 introduced two new interesting time structures, DateOnly
and TimeOnly
, see this PR.
Currently one can workaround the missing APIs in Fluent Assertions by converting DateOnly
to DateTime
and TimeOnly
to TimeSpan
.
new DateOnly().ToDateTime(TimeOnly.MinValue).Should();
new TimeOnly().ToTimeSpan().Should();
It would be nice if we had native APIs for asserting on DateOnly
and TimeOnly
.
I believe most assertions can simply be copied from the [Nullable]DateTimeAssertions
and [Nullable]SimpleTimeSpanAssertions
.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Using DateOnly and TimeOnly in .NET 6 - Steve Gordon
DateOnly and TimeOnly allow developers to represent either the date or time portion of a DateTime. These two new types are structs (value...
Read more >DateOnly in .NET 6 and ASP.NET Core 6
Use string like yyyy-MM-dd , or yyyyMMdd . And convert the object to DateTime for calculating date span. Use DateTime or DateTimeOffset and...
Read more >How to use the DateOnly and TimeOnly structures
DateOnly can be parsed from a string, just like the DateTime structure. All of the standard .NET date-based parsing tokens work with DateOnly...
Read more >End to End Unit Testing for .NET 6 Web API
Let's see how to solve this issue with .NET 6 tests. Let's start by creating a UnitTest project by executing following cmd dotnet...
Read more >Releases - Fluent Assertions
A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style unit...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@julealgon I was working on it previously, haven’t progressed much and I’m lacking time. If you want you can open a PR for it.
@iliashkolyar Fluent Assertions now also target net6.0.