예제 #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);
        }
예제 #2
0
        public void SerializeSpecialSymbols()
        {
            string scarySymbols = "&><";

            Stub.On(activity).GetProperty("Name").Will(Return.Value(scarySymbols));

            XmlNode xml = ActivitySerializer.SerializeToXml(activity);

            Assert.AreEqual(scarySymbols, xml["Activity"].InnerText);
        }
예제 #3
0
        public void SerializeActivity()
        {
            Stub.On(activity).GetProperty("Name").Will(Return.Value("reading"));

            XmlNode xml = ActivitySerializer.SerializeToXml(activity);

            Assert.AreEqual("reading", xml["Activity"].InnerText);
            Assert.AreEqual("5:00:00", xml["Start"].InnerText);
            Assert.AreEqual("1:23:45", xml["Duration"].InnerText);
        }