I'm wondering if anybody's found a good solution to this:
In our unit tests; we commonly use Assert.AreEqual()
to validate our results. All is well and good; until we start trying to use this on DateTime properties.
Although the times are very similar, sometimes they are off by milliseconds, which causes the tests to fail. In our application; as long as they're accurate to the second; that's good enough for us.
Has anybody found a good way to somehow implement tolerances in this case? Typically our workaround is to split it into 2 separate statements; one which checks the .ToShortDateString()
, and another that checks .ToShortTimeString()
, but this looks sloppy in my opinion.