Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add assertions for net6.0 DateOnly/TimeOnly #1754

Closed
jnyrup opened this issue Dec 2, 2021 · 7 comments · Fixed by #1848 or #1844
Closed

Add assertions for net6.0 DateOnly/TimeOnly #1754

jnyrup opened this issue Dec 2, 2021 · 7 comments · Fixed by #1848 or #1844

Comments

@jnyrup
Copy link
Member

jnyrup commented Dec 2, 2021

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.

@jnyrup jnyrup changed the title Add Assertions for net6.0 DateOnly/TimeOnly Add assertions for net6.0 DateOnly/TimeOnly Dec 2, 2021
@julealgon
Copy link

@MullerWasHere can you confirm that you are working on this issue?

@MullerWasHere
Copy link
Contributor

@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
Copy link
Contributor

@jnyrup
Wondering regarding this one.
Shouldn't there be some prerequisite PR that adds net6.0 support to all relevant projects and builds before being able to add support to these new time structures?

@jnyrup
Copy link
Member Author

jnyrup commented Mar 5, 2022

My initial thought was that adding .NET 6 could be done as part of adding these assertions, as there otherwise is no/little value in adding the extra target framework.

@iliashkolyar
Copy link
Contributor

iliashkolyar commented Mar 5, 2022

Well, I tried to do so but it wasn't that straightforward.
There are a several compilation flags that check the TargetFramework and Include/Remove dependencies accordingly (like Common/NullConfigurationStore.cs). These are spread out across multiple projects, and the code analyzers are also configured via these flags.
There are several obsolete methods that fail compilation after the addition of the net6.0 framework such as BinaryFormatter.Serialize(Stream, object) and BinaryFormatter.Deserialize(Stream) (https://aka.ms/binaryformatter).

I think that these changes are not in scope for this specific feature implementation and should probably be performed by someone with better familiarity with the project.
What do you think?

@jnyrup
Copy link
Member Author

jnyrup commented Mar 5, 2022

Oh, thought it would be more straight forward.
I'll take a stab at adding .NET 6.

@jnyrup jnyrup mentioned this issue Mar 5, 2022
5 tasks
@jnyrup
Copy link
Member Author

jnyrup commented Mar 6, 2022

@iliashkolyar Fluent Assertions now also target net6.0.

@jnyrup jnyrup linked a pull request Mar 14, 2022 that will close this issue
5 tasks
@jnyrup jnyrup linked a pull request Mar 14, 2022 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants