Example #1
0
        private void List_SaveList()
        {
            ToDoList testList = new ToDoList();

            testList.AddTaskToList("List_SaveList One");
            testList.MarkTaskAsDone(0);
            testList.AddTaskToList("List_SaveList Two");
            testList.MarkTaskAsNotCompleted(1);
            testList.AddTaskToList("List_SaveList Three");
            testList.MarkTaskAsDone(2);

            ListIO listIO = new ListIO();

            listIO.SaveTaskList(testList.Tasks);
        }
Example #2
0
        private void List_LoadList()
        {
            // This test is fragile as it relies on having the list from List_SaveList already
            // run.  Better would be for it to pull in a separate file, but that would
            // require modifying ListIOFunctions.LoadTaskList to suppoort having a filename
            ToDoList testList = new ToDoList();
            ListIO   listIO   = new ListIO();

            listIO.LoadTaskList(testList);
            testList.Tasks[0].Description.ShouldBe("List_SaveList One");
            testList.Tasks[0].IsDone.ShouldBe(true);
            testList.Tasks[1].Description.ShouldBe("List_SaveList Two");
            testList.Tasks[1].IsDone.ShouldBe(false);
            testList.Tasks[2].Description.ShouldBe("List_SaveList Three");
            testList.Tasks[2].IsDone.ShouldBe(true);
        }