Beispiel #1
0
        public void DeserializeLinkToActivity()
        {
            Task task = TaskSerializer.Deserialize("<task name=\"task1\"><activity>activity1</activity></task>");

            Assert.AreEqual("activity1", task.RelatedActivities[0], "related activity");
            Assert.AreEqual(1, task.RelatedActivities.Count, "related activities count");
        }
        public static ITaskCollection Deserialize(XmlNode xml)
        {
            ITaskCollection taskCollection = new TaskCollection();

            foreach (XmlNode root in xml.ChildNodes)
            {
                if (root.Name == ROOT_NODE)
                {
                    foreach (XmlNode taskXml in root.ChildNodes)
                    {
                        Task task = TaskSerializer.Deserialize(taskXml);
                        if (task != null)
                        {
                            taskCollection.Add(task);
                        }
                    }
                }
            }
            return(taskCollection);
        }
Beispiel #3
0
 public void DeserializeBrokenTask()
 {
     Assert.IsNull(TaskSerializer.Deserialize("<task>&</task>"));
 }
Beispiel #4
0
        public void DeserializeWorkingProperty()
        {
            Task task = TaskSerializer.Deserialize("<task name=\"task1\" working=\"false\"/>");

            Assert.IsFalse(task.IsWorking);
        }
Beispiel #5
0
        public void Deserialize()
        {
            Task task = TaskSerializer.Deserialize("<task name=\"deserialized_task\"></task>");

            Assert.AreEqual("deserialized_task", task.Name);
        }
Beispiel #6
0
        public void DeserializeSubtask()
        {
            Task task = TaskSerializer.Deserialize("<task name=\"parent\"><task name=\"sub\"/></task>");

            Assert.AreEqual("sub", task.Nodes[0].Name);
        }
Beispiel #7
0
        public void DeserializeTaskWithIncorrectWorking()
        {
            Task task = TaskSerializer.Deserialize("<task name=\"task1\" working=\"aaa\" />");

            Assert.IsTrue(task.IsWorking);
        }