Database Reference
In-Depth Information
you think. If it does, great! - that means the test will ensure it continues to work
like that. If not, you either need to change your test to match what the code does,
or change the code to match the test expectation.
Where to go from here?
You've probably heard many times that unit testing your work is key to maintaining
a stable software product. While Core Data can help eliminate a lot of error-prone
persistence code from your project, it can be a source of logic errors if used
incorrectly.
Writing unit tests that can use Core Data will help stabilize your code before it even
reaches your users. XCTestExpectation is a simplistic yet powerful helper in your
quest to test Core Data in an asynchronous manner. Use it wisely.
Challenge: The CampSiteService has a number of methods that are not
implemented yet, marked with TODO comments. Using a TDD approach, write
unit tests and then implement the methods to make the tests pass.
Check out the final project included in the resources for this chapter for a
sample solution if you get stuck.
 
Search WWH ::




Custom Search