After reading several posts and articles about this issue I'm still confused about how to test a method in a VIPER architecture (for example with Swift).
If I had this code:
Presenter class
protocol InteractorToPresenterProtocol: class {
func showInfo(info: Info)
}
class Presenter {
private var interactor: PresenterToInteractorProtocol?
init() {}
func makeSomeStuffInPresenter() {
// make some stuff
...
interactor?.makeSomeStuffInInteractor()
}
}
extension Presenter : InteractorToPresenterProtocol {
func showInfo(info: Info) {
print(info)
}
}
Interactor class:
protocol PresenterToInteractorProtocol: class {
func makeSomeStuffInInteractor()
}
class Interactor {
private var presenter: InteractorToPresenterProtocol?
init() {}
}
extension Interactor : PresenterToInteractorProtocol {
func makeSomeStuffInInteractor() {
// make some stuff
...
presenter?.showInfo(info)
}
}
How should I test makeSomeStuffInPresenter method?