Storing and loading ToDoItems
To test storing and loading to-do items, we first need to create an instance of the ToDoItemStore
class, add a to-do item, destroy that store instance, and create a new one. When we add a to-do item in the first instance, all items should be stored in the filesystem. When creating the second instance, the stored items should be loaded again from the filesystem. This means when we find the item we added in the first instance after we created the second instance, storing and loading works.
Implementing storing and loading
It is essential that the test controls the environment needed for itself. This means for storing and loading to-do items, the test needs to control where the items are stored. For example, if we used Core Data to persist the to-do items, the test would be responsible for setting up a fake Core Data store just used for the test. In our app, we will store the to-do items in a JSON file. So, the test needs to control where the JSON file...