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

Added EqualTimeBaseConstraint #4853

Closed
wants to merge 1 commit into from
Closed

Conversation

manfred-brands
Copy link
Member

@manfred-brands manfred-brands commented Oct 6, 2024

Third PR working towards #53 and Related to #4847 and #4848

This constraint use classes (EqualTimeBasedConstraintWithNumericTolerance) to limit in what cases we can specify the .Seconds etc. modifiers.

So we allow: Assert.That(date1, Is.EqualTo(date2).Within(3).Seconds);
but not: Assert.That(date1, Is.EqualTo(date2).Seconds)
nor: Assert.That(date1, Is.EqualTo(date2).Within(timeSpan).Seconds)

Because the class with tolerance is different than the one without this also doesn't allow repeats like:
Assert.That(date1, Is.EqualTo(date2).Within(1).Hours.Seconds.Within(3))

Fixes #4877

@OsirisTerje OsirisTerje marked this pull request as ready for review November 2, 2024 09:41
Copy link
Member

@OsirisTerje OsirisTerje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me. AFAICS the Equal constraints have to separate for at least 1) each group of primitive types (Numeric, Date/Time, bools, char/strings), where the groups often have things in common and then 2) when the types within the group differs in such a way it is better to seperate there too. So to me this is on the right way.

@OsirisTerje
Copy link
Member

OsirisTerje commented Nov 4, 2024

@manfred-brands All three EqualTo..... PRs are approved. Do you want to do more changes, or can they be merged ?

@manfred-brands
Copy link
Member Author

@OsirisTerje I think I extracted the common .Using in a base class, but cannot remember if all branches use that. I need to check/ensure that.

@manfred-brands
Copy link
Member Author

Due to merge conflicts superseded by combined PR #4882

@manfred-brands manfred-brands deleted the datetimeConstraint branch December 27, 2024 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix EqualTo modifiers for DateTime
2 participants