public void TestReplaceTaskICal() { Application app = new ApplicationClass(); OutlookTasksWithICal agent = new OutlookTasksWithICal(app); OutlookTasks outlookAgent = new OutlookTasks(app); TestAddTaskICal(); string existingEntryId = outlookAgent.GetEntryIdByDisplayName("Demo Task Sunbird"); string x = File.ReadAllText(MockPath + "todo.ics"); string entryId = agent.ReplaceItem(x, existingEntryId); Assert.IsTrue(entryId == existingEntryId); TaskItem task = outlookAgent.GetItemByEntryId(entryId); var collection = iCalendar.LoadFromFile(MockPath + "todo.ics"); var calendar = collection.FirstOrDefault(); var todo = calendar.Todos[0]; CompareIcalTodoAndAppointment(todo, task); System.Threading.Thread.Sleep(5000);//Silly, outlook will take a few seconds to finish the creation of the task object. Without such waiting, readind the item may be incorrect. //Test ReadItemToText() string icalText = agent.ReadItemToText(task); collection = iCalendar.LoadFromStream(new StringReader(icalText)); calendar = collection.FirstOrDefault(); todo = calendar.Todos[0]; CompareIcalTodoAndAppointment(todo, task); }