This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| class LoginModule { | |
| func build() -> UIViewController { | |
| let view = LoginViewController() | |
| let router = LoginRouter() | |
| let interactor = LoginInteractor() | |
| let presenter = LoginPresenter(interface: view, interactor: interactor, router: router) | |
| view.presenter = presenter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| // MARK: - View | |
| /// Presenter -> ViewController | |
| protocol LoginViewProtocol: AnyObject { | |
| var presenter: LoginPresenterProtocol? { get set } | |
| } | |
| // MARK: - Interactor | |
| /// Presenter -> Interactor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @testable import VIPER_Example | |
| import Foundation | |
| class MockLoginPresenter: LoginPresenterProtocol, LoginInteractorOutputProtocol { | |
| // MARK: - LoginPresenterProtocol | |
| var interactor: LoginInteractorInputProtocol? | |
| // MARK: - Properties | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func testThatLogInButtonTappedCallsPresenterLogInTapped() { | |
| viewController.logInButtonTapped() | |
| XCTAssertTrue(presenter.logInTappedCalled) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func testThatLogInTappedCallsInteractorPerformLogInRequest() { | |
| presenter.logInTapped() | |
| XCTAssertTrue(interactor.performLogInRequestCalled) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func testThatPerformLogInRequestCallsPresenterDidLogInSuccessfullyOnSuccess() { | |
| interactor.username = "Valid Username" | |
| interactor.password = "Valid Password" | |
| interactor.performLogInRequest() | |
| XCTAssertTrue(presenter.didLogInSuccessfullyCalled) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func testThatDidLogInSuccessfullyCallsRouterNavigateToHomeCalled() { | |
| presenter.didLogInSuccessfully() | |
| XCTAssertTrue(router.navigateToHomeCalled) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| class LoginModule { | |
| func build() -> UIViewController { | |
| let view = LoginViewController() | |
| let router = LoginRouter() | |
| let interactor = LoginInteractor() | |
| let presenter = LoginPresenter(interface: view, interactor: interactor, router: router) | |
| view.presenter = presenter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| // MARK: - View | |
| /// Presenter -> ViewController | |
| protocol LoginViewProtocol: AnyObject { | |
| var presenter: LoginPresenterProtocol? { get set } | |
| } | |
| // MARK: - Interactor | |
| /// Presenter -> Interactor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @testable import VIPER_Example | |
| import Foundation | |
| class MockLoginPresenter: LoginPresenterProtocol, LoginInteractorOutputProtocol { | |
| // MARK: - LoginPresenterProtocol | |
| var interactor: LoginInteractorInputProtocol? | |
| // MARK: - Properties | |
OlderNewer