public void Serialize()
        {
            TaskCollection taskCollection = new TaskCollection();

            taskCollection.Add(new Task("task_name"));

            XmlNode xml = TaskCollectionSerializer.Serialize(taskCollection);

            Assert.IsTrue(xml.InnerXml.Contains("task_name"));
        }
        public void SerializeToWriter()
        {
            ITaskCollection taskCollection = new TaskCollection();

            taskCollection.Add(new Task("task1"));
            StringBuilder sb     = new StringBuilder();
            TextWriter    writer = new StringWriter(sb);

            TaskCollectionSerializer.Serialize(taskCollection, writer);
            writer.Close();

            Assert.IsTrue(sb.ToString().Contains("task1"));
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public void IsWorkingTaskTrue()
 {
     tasks.Add(new Task("working task"));
     Assert.IsTrue(tasks.IsWorking("working task"));
 }