tpierrain/NFluent

IsCloseTo is missing for DateTime and DateTimeOffset

ocoanet opened this issue · 0 comments

There is no way to compare timestamps with a specified tolerance. The IsEqualToIgnoring... methods are convenient but they are quite specific and can fail when the time difference is very small.

I suggest to add new extension methods for DateTime and DateTimeOffset for this purpose. They could be named IsCloseTo to matching the equivalent methods for float and double.

Usage:

Check.That(reference).IsCloseTo(expected, new Duration(1, TimeUnit.Milliseconds));