Skip to content

Update error message at DateTimeAssertions.BeCloseTo() to include the calculated time range #2012

@ITaluone

Description

@ITaluone

Before you file a bug, have you:

  • Tried upgrading to newest version of Fluent Assertions, to see if your issue has already been resolved and released?
  • Checked existing open and closed issues, to see if the issue has already been reported?
  • Tried reproducing your problem in a new isolated project?
  • Read the documentation?
  • Considered if this is a general question and not a bug?. For general questions please use StackOverflow.

Description

Now the error message looks like this:
Expected logs.First().ChangedAt to be within 15s from <2022-10-13 06:44:06.8277343>, but found <2022-10-13 06:43:51>.

But with this line I have to calculate the difference between the two DateTimes in case I want to know the exact difference.

Complete minimal example reproducing the issue

This is not an issue inside FA, but a proposal to state more precisely what the time differnece was.

Expected behavior:

Something like:
Expected logs.First().ChangedAt to be within 15s from <2022-10-13 06:44:06.8277343>, but found <2022-10-13 06:43:51>, which is XXXs.

Actual behavior:

The calculated difference is not displayed.

Versions

  • Which version of Fluent Assertions are you using? 6.7.0
  • Which .NET runtime and version are you targeting? .net6.0 and .net7.0

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions