예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public void ParseDateOnly()
        {
            DateTime parsedDateTime = Extensible.ParseDateTimeCorrectly("2007-02-03");

            Assert.IsTrue(parsedDateTime.Kind == DateTimeKind.Utc);
            Assert.AreEqual(new DateTime(2007, 2, 3), parsedDateTime);
        }
예제 #4
0
 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);
 }
예제 #5
0
 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());
 }
예제 #6
0
        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);
        }
예제 #7
0
 public void ParseDate_Bad_Throws()
 {
     Extensible.ParseDateTimeCorrectly("2007-02-03T03:01:39");
 }