You can watch this episode by subscribing to Cocoacasts Plus.

Building a Weather Application From Scratch

Unit Testing With Mock Objects

Earlier in this series, we wrote unit tests for the DayViewModel, the WeekViewModel, and the WeekDayViewModel structs. Writing those unit tests was fairly straightforward. Unit testing the RootViewModel class is a bit more challenging for a number of reasons.

The RootViewModel class asynchronously fetches the location of the device and weather data for a location. To unit test asynchronous operations, we need to take a different approach.

Purchase Course

Purchase Building a Weather Application From Scratch and access it whenever you want and for as long as you want.

Join Cocoacasts Plus

Join Cocoacasts Plus and access every 350+ tutorials including Building a Weather Application From Scratch.

Next Episode "Unit Testing Asynchronous Code"