question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add assertions for net6.0 DateOnly/TimeOnly

See original GitHub issue

Description

.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:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
MullerWasHerecommented, Jan 18, 2022

@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.

1reaction
jnyrupcommented, Mar 6, 2022

@iliashkolyar Fluent Assertions now also target net6.0.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found