Saturday, 31 August 2013

Update datetime in Database

Update datetime in Database

Consider this code:
var datetime = DateTime.Now;
var instantMessage =
InstantMassageingManager.GetConverationMessages().FirstOrDefault();

InstantMassageingManager.UpdateConversationMessageReadDateTime(instantMessage.InstantMessageInstanceId,
datetime);
var message =
InstantMassageingManager.GetMessageById(instantMessage.InstantMessageInstanceId);
Assert.IsTrue(message.ReadDateTime.Value == datetime);
in the first line i get DateTime.Now
then I update a record in database:UpdateConversationMessageReadDateTime
and get the message again from database:
Both message.ReadDateTime and datetime has same value but with different
Tick.
So my test doesn't pass.
Why have diffrent tick?

No comments:

Post a Comment