c# - Why datetime cannot compare? -
my c# unit test has following statement:
assert.areequal(logouttime, log.first().timestamp);
why failed following information:
assert.areequal failed. expected:<4/28/2010 2:30:37 pm>. actual:<4/28/2010 2:30:37 pm>.
are not same?
update:
use if care second:
assert.areequal(logouttime.tostring(), log.first().timestamp.tostring());
have verified number of ticks/milliseconds equal?
if datetime.now()
twice back, appear same number down minute , down second, vary ticks. if want check equality minute, compare each datetime degree. information on rounding datetimes, see here
the property used measure performance. however, because of low resolution, not suitable use benchmarking tool. better alternative use stopwatch class.
Comments
Post a Comment