-
Notifications
You must be signed in to change notification settings - Fork 758
Closed
Milestone
Description
It would be nice if the following code worked:
public static DateTime LastDateAccessed { get; set; } // simulate a remote value
[Test]
public void TestMe()
{
DateTime beforeUpdate = DateTime.UtcNow;
// Do operation
LastDateAccessed = DateTime.UtcNow.AddMilliseconds(-50); // some kind of timing imperfection on the server
// This fails because of the timing issue
Assert.That(LastDateAccessed, Is.GreaterThan(beforeUpdate));
// It would be nice to do this
Assert.That(LastDateAccessed, Is.GreaterThan(beforeUpdate).Within(TimeSpan.FromSeconds(1)));
}For consistency, this should probably be done on all constraints that extend ComparisonConstraint.
I am willing to take up the task. I just want to make sure this is kind of change would be accepted.