public void ParseDateTimeNoTimeZone() { DateTime parsedDateTime = Extensible.ParseDateTimeCorrectly("2007-02-03T03:01:39Z"); Assert.IsTrue(parsedDateTime.Kind == DateTimeKind.Utc); Assert.AreEqual(new DateTime(2007, 2, 3, 3, 1, 39, DateTimeKind.Utc), parsedDateTime); }
public void ParseDateTimeWithTimeZoneAtBeginningOfYear() { DateTime parsedDateTime = Extensible.ParseDateTimeCorrectly("2005-01-01T01:11:11+8:00"); Assert.IsTrue(parsedDateTime.Kind == DateTimeKind.Utc); Assert.AreEqual(new DateTime(2004, 12, 31, 17, 11, 11, DateTimeKind.Utc), parsedDateTime); }
public void ParseDateOnly() { DateTime parsedDateTime = Extensible.ParseDateTimeCorrectly("2007-02-03"); Assert.IsTrue(parsedDateTime.Kind == DateTimeKind.Utc); Assert.AreEqual(new DateTime(2007, 2, 3), parsedDateTime); }
private static Extensible AddDates(Extensible extensibleInfo) { extensibleInfo.CreationTime = Extensible.ParseDateTimeCorrectly("2003-08-07T08:42:42Z"); extensibleInfo.ModificationTime = Extensible.ParseDateTimeCorrectly("2005-01-01T01:11:11+8:00"); return(extensibleInfo); }
public void ParseDateTimeCorrectly() { Assert.AreEqual(DateTimeKind.Utc, Extensible.ParseDateTimeCorrectly("2003-08-07T08:42:42Z").Kind); Assert.AreEqual(DateTimeKind.Utc, Extensible.ParseDateTimeCorrectly("2005-01-01T01:11:11+8:00").Kind); Assert.AreEqual(DateTimeKind.Utc, Extensible.ParseDateTimeCorrectly("2005-01-01").Kind); Assert.AreEqual("00:00:00", Extensible.ParseDateTimeCorrectly("2005-01-01").TimeOfDay.ToString()); }
public void EntryWithIncomingUnspecifiedModTimeNotPruned() { Guid g = Guid.NewGuid(); Extensible eInfo = CreateFullextensibleInfo(g); LexEntry item = _dataMapper.CreateItem(); item.Guid = eInfo.Guid; item.Id = eInfo.Id; item.ModificationTime = eInfo.ModificationTime; item.CreationTime = eInfo.CreationTime; _dataMapper.SaveItem(item); //strip out the time eInfo.ModificationTime = Extensible.ParseDateTimeCorrectly("2005-01-01"); Assert.AreEqual(DateTimeKind.Utc, eInfo.ModificationTime.Kind); LexEntry found = _builder.GetOrMakeEntry(eInfo, 0); Assert.IsNotNull(found); }
public void ParseDate_Bad_Throws() { Extensible.ParseDateTimeCorrectly("2007-02-03T03:01:39"); }