Example #1
0
        public void Serialize()
        {
            Task    task = new Task("task1");
            XmlNode xml  = TaskSerializer.Serialize(task);

            Assert.IsTrue(xml.OuterXml.Contains("task1"));
        }
Example #2
0
        public void SerializeWorkingProperty()
        {
            Task task = new Task("rest", false);

            XmlNode xml = TaskSerializer.Serialize(task);

            Assert.AreEqual("false", xml.Attributes["working"].Value);
        }
Example #3
0
        public void SerializeSubtask()
        {
            Task task = new Task("parent");

            task.Nodes.Add(new Task("sub"));
            XmlNode xml = TaskSerializer.Serialize(task);

            Assert.AreEqual("sub", xml.ChildNodes[0].Attributes["name"].Value);
        }
Example #4
0
        public void SerializeLinkToActivityWithSpecialSymbols()
        {
            Task task = new Task("task1");

            task.RelatedActivities.Add("a&b>c");

            XmlNode xml = TaskSerializer.Serialize(task);

            Assert.IsTrue(xml.InnerText.Contains("a&b>c"));
        }
        public void Deserialize()
        {
            XmlDocument doc = new XmlDocument();

            doc.AppendChild(doc.CreateElement("tasks")).InnerXml =
                TaskSerializer.Serialize(new Task("task1")).OuterXml;

            ITaskCollection taskCollection = TaskCollectionSerializer.Deserialize(doc);

            Assert.IsTrue(taskCollection.Contains("task1"));
        }
        public static XmlNode Serialize(ITaskCollection taskCollection)
        {
            XmlDocument doc  = new XmlDocument();
            XmlNode     root = doc.AppendChild(doc.CreateElement(ROOT_NODE));

            if (taskCollection != null)
            {
                foreach (Task task in taskCollection)
                {
                    root.InnerXml += TaskSerializer.Serialize(task).OuterXml;
                }
            }
            else
            {
                Log.Error("Could not serialize null tasks collection");
            }
            return(doc);
        }
Example #7
0
 public void SerializeWithNull()
 {
     Assert.IsNull(TaskSerializer.Serialize(null));
 }