Exemplo n.º 1
0
        public void LoselessFormatTest()
        {
            var d1 = new MessageTimestamp(new DateTime(2010, 10, 22, 3, 3, 4, DateTimeKind.Local));
            var d2 = new MessageTimestamp(new DateTime(2010, 10, 22, 3, 3, 4, DateTimeKind.Utc));
            var d3 = new MessageTimestamp(new DateTime(2010, 10, 22, 3, 3, 4, DateTimeKind.Unspecified));

            var d1_str      = d1.StoreToLoselessFormat();
            var d2_str      = d2.StoreToLoselessFormat();
            var d3_str      = d3.StoreToLoselessFormat();
            var d1_restored = MessageTimestamp.ParseFromLoselessFormat(d1_str);
            var d2_restored = MessageTimestamp.ParseFromLoselessFormat(d2_str);
            var d3_restored = MessageTimestamp.ParseFromLoselessFormat(d3_str);

            Assert.AreEqual(0, MessageTimestamp.Compare(d1, d1_restored));
            Assert.AreEqual(0, MessageTimestamp.Compare(d2, d2_restored));
            Assert.AreEqual(0, MessageTimestamp.Compare(d2, d2_restored));
        }
Exemplo n.º 2
0
 static MessageTimestamp ParseDateTime(string str)
 {
     return(MessageTimestamp.ParseFromLoselessFormat(str));
 }
Exemplo n.º 3
0
 internal TextLogEventTrigger(XmlReader reader)
     : this(
         long.Parse(reader.GetAttribute(triggerPositionAttrShort)),
         MessageTimestamp.ParseFromLoselessFormat(reader.GetAttribute(triggerTimestampAttrShort)))
 {
 }
Exemplo n.º 4
0
 public TextLogEventTrigger(XElement evtElement) : this(
         long.Parse(evtElement.Attribute(triggerPositionAttr).Value),
         MessageTimestamp.ParseFromLoselessFormat(evtElement.Attribute(triggerTimestampAttr).Value))
 {
 }