December 2018
Intermediate to advanced
414 pages
10h 19m
English
Because the whole state of the view can be tested externally, thanks to the MVVM pattern, we can write better and more maintainable code. Let's look at how we can properly test the logic of the ViewModel, in order to ensure that the views bound to it will react properly.
Ultimately, we need to ensure the following:
class ViewModelTesting: XCTestCase { func testCallsNextQuestion() { let questions = QuestionController(questions: [Question(question: "OK", answer: .true)]) let viewModel = ViewModel(questions: questions) var called = false viewModel.onQuestionChanged
Read now
Unlock full access