I am writing a unit test which stores an object with a DateTime
parameter into a DATETIME2
SQL Server database column. I then create a temporary DateTime
object called new_date_time
and set that value to DateTime.Now
.
The new_date_time
value is then used to update the previous value and the SQL query to do this completes successfully.
When re-reading the object back from the database I receive the correct datetime
values for days/hours/minutes but the .Ticks
value is different from the new_date_time
variables .Ticks
property. The value returned from the read call returns the last 4 digits of the .Ticks
property as zeros.
Why is this rounding occurring making my Assert.AreEqual
fail?? :)
Thanks