From the course: iOS App Development: Test-Driven Development

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Add manager functionality

Add manager functionality

From the course: iOS App Development: Test-Driven Development

Start my 1-month free trial

Add manager functionality

- [Instructor] Before we go any further, let's add some comments, so that we can have a clean idea of what we're doing in each test class. So here I'm just going to add pragma MARK, with two forward slashes, and I'm going to say Initial Values for these tests, and underneath our testInit_MoviesSeen, I'm going to add another pragma MARK, and we're going to call this the Add & Query section. All right, so let's keep flushing out the MovieManager class with the ability to add movies to our library, which will also increase the moviesToSeeCount each time we call this. So let's start with our new function, func testAdd_MoviesToSee_ReturnsOne(), and in here we want a test movie, so let testMovie = Movie(title: "Sci-Fi"), and we're going to use our sut.addMovie. Now this function doesn't exist yet, but it's going to take in a movie when it does, and we're just going to pass it in our testMovie. Finally, let's add our XCTAssertEqual, and we want to make sure that our sut.moviesToSeeCount is…

Contents