Checking the to-do item
When the user of the app taps the Done button, our app has to tell the to-do item store to change the item's status to Done. Follow these steps to implement that feature:
- Add the following test method to
ToDoItemDetailsViewControllerTests
:// ToDoItemDetailsViewControllerTest.swift func test_sendingButtonAction_shouldCheckItem() { let toDoItem = ToDoItem(title: "dummy title") sut.toDoItem = toDoItem let storeMock = ToDoItemStoreProtocolMock() sut.toDoItemStore = storeMock }
ToDoItemDetailsViewController
doesn't have a property for toDoItemStore
. This means we have to pause writing this test and add this property first.
- Go to
ToDoItemDetailsViewController
and add thetoDoItemStore
property:// ToDoItemDetailsViewController.swift var toDoItemStore: ToDoItemStoreProtocol?
- Now we can finish the test:
// ToDoItemDetailsViewControllerTests.swift func test_sendingButtonAction_shouldCheckItem...