Beispiel #1
0
        public void SerializeAndDeserialize()
        {
            IActivity first  = new Activity("activity", DateTime.Parse("5:00:00"), TimeSpan.Parse("1:23:45"));
            IActivity second = ActivitySerializer.Deserialize(ActivitySerializer.SerializeToXml(first));

            Assert.AreEqual(first, second);
        }
Beispiel #2
0
        public void OldTimeFormat()
        {
            XmlDocument doc = new XmlDocument();

            doc.InnerXml = "<Records>" +
                           "<Activity>yoga</Activity>" +
                           "<Begin>PT7H1M</Begin>" +
                           "<Duration>PT9M38S</Duration>" +
                           "</Records>";

            activity = ActivitySerializer.Deserialize(doc.FirstChild);

            Assert.AreEqual("yoga", activity.Name);
            Assert.AreEqual(DateTime.Parse("7:01:00"), activity.Start);
            Assert.AreEqual(TimeSpan.Parse("0:09:38"), activity.Duration);
        }
Beispiel #3
0
        public void BeginSupport()
        {
            XmlDocument doc = new XmlDocument();

            doc.InnerXml = "<Records>" +
                           "<Activity>activity</Activity>" +
                           "<Begin>6:00:00</Begin>" +
                           "<Duration>2:34:50</Duration>" +
                           "</Records>";

            activity = ActivitySerializer.Deserialize(doc.FirstChild);

            Assert.AreEqual("activity", activity.Name);
            Assert.AreEqual(DateTime.Parse("6:00:00"), activity.Start);
            Assert.AreEqual(TimeSpan.Parse("2:34:50"), activity.Duration);
        }
Beispiel #4
0
        public void DeserializeActivity()
        {
            XmlDocument doc = new XmlDocument();

            doc.InnerXml = "<Records>" +
                           "<Activity>activity</Activity>" +
                           "<Start>5:00:00</Start>" +
                           "<Duration>1:23:45</Duration>" +
                           "</Records>";

            activity = ActivitySerializer.Deserialize(doc.FirstChild);

            Assert.AreEqual("activity", activity.Name);
            Assert.AreEqual(DateTime.Parse("5:00:00"), activity.Start);
            Assert.AreEqual(TimeSpan.Parse("1:23:45"), activity.Duration);
        }