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

Unlock the full course today

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

Data source and delegate setup

Data source and delegate setup

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

Start my 1-month free trial

Data source and delegate setup

- [Instructor] Alright, for the rest of this section we're going to focus on testing our table view. Since we're aiming to be good software developers, we're going to decouple the data source and delegate into a separate class. But first let's make ourself a new pragma mark underneath the nil checks and name this one Data Source. Let's also start a new test function and we're going to call this testDataSource_viewDidLoad_SetsTableViewDataSource. Inside the test, we're going to assert that our data source is not nil and that it's of type MovieLibraryDataService, which is going to be our decoupled class. So let's say XCTAssertNotNil, and we're going to use our sut library table view data source. And we're also going to say XCTAssertTrue, that sub.librarytableview.datasource is of type MovieLibraryDataService. And we're going to get our first error here because our data service class doesn't exist yet. So let's go into our film fest folder, right click, and select New Group. Go ahead and…

Contents