i use NHibernate and Spring.net templates for creating DAO. i wrote some tests for saving and retrieving entities. Problem is all test pass on our local machines but on Jenkins there are strange problems with DateTime variables:
Message:
Expected: 2011-06-16 15:19:23.765
But was: 2011-06-16 15:19:23.765
Any clues what may be the reason?
I suspect that the two dates are subtly different, in the sub-millisecond range, probably due to the storage not supporting date/time values to the “ticks” precision.
If you’re really lucky, NUnit may provide an “equal within certain tolerance” for
DateTimeas it does fordouble. If not, something like this would be okay:Either that, or potentially round or truncate both
DateTimevalues to the appropriate millisecond, and then useAreEqual. That would definitely give a more useful failure message.