Data duplication in some instances is a relevant feature, but in our application we only want unique movies to appear in our list. In this video, learn how to add a simple check to make sure this is implemented correctly.
- [Instructor] While we're here in the MovieStructTests,…I'm going to add two pragma MARKs to keep things organized.…So at the top of our Init functions,…I'm going to add two forward slashes and our MARK keyword,…and just put this as Initialization section.…The start of our equatable section,…I'm going to do the same thing, and save it off.…Now if we look at our MovieManager, it's almost finished,…but there are two critical things it still can't handle:…clearing out our movie arrays,…and checking for duplicate entries.…
So in our MovieManagerTests, let's add a new function…called func testClearArrays_ReturnsArrayCountsOfZero,…and here let's add a couple movies to our library,…addMovie, scifi, and addMovie, action.…Let's checkOffMovie at index 0, which is going to be our scifi,…and add some assertions.…So XCTAssertEqual, and we want to check…that our moviesToSeeCount is now equal to 1,…and we need another assertion, XCTAssertEqual,…and we're going to say sut.moviesSeenCount…is also equal to 1, so we've got one in each list.…
- What is test-driven development?
- Creating and expanding a data model
- Creating a manager class
- Testing class methods
- Checking for duplicates
- Testing table views
- Mocking cells
- Testing cell selection
- Assembling the app
Skill Level Intermediate
1. Foundation and Theory
2. Getting Started
3. The Manager Class
4. TableView Testing
5. Finishing Touches
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.