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
class InteractorSpy { | |
private(set) var didCallExecute = false | |
} | |
extension InteractorSpy: Interactor { | |
func execute() { | |
didCallExecute = true | |
} | |
} |
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
class InteractorFactorySpy { | |
private(set) var invokedTrackID = -1 | |
private(set) var invokedName = "" | |
private(set) var trackSummaryInteractor: Interactor! | |
private(set) var trackNameUpdateInteractor: Interactor! | |
func stubWithTrackSummaryInteractor(interactor: Interactor) { | |
trackSummaryInteractor = 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
import XCTest | |
class TrackSummaryViewEventHandlerTests: XCTestCase { | |
private(set) var interactorSpy: InteractorSpy! | |
private(set) var factorySpy: InteractorFactorySpy! | |
private(set) var eventHandler: TrackSummaryViewEventHandler! | |
override func setUp() { | |
super.setUp() | |
interactorSpy = InteractorSpy() |
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
protocol PresenterFactory { | |
func createTrackSummaryPresenterWithOutput(output: TrackSummaryPresenterOutput) -> TrackSummaryPresenter | |
} | |
class PresenterFactoryImpl {} | |
extension PresenterFactoryImpl: PresenterFactory { | |
func createTrackSummaryPresenterWithOutput(output: TrackSummaryPresenterOutput) -> TrackSummaryPresenter { | |
return TrackSummaryPresenter(output: output) | |
} |
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
protocol InteractorFactory { | |
func createTrackSummaryInteractor(output: TrackSummaryInteractorOutput) -> Interactor | |
func createTrackNameUpdateInteractor(trackID: Int, name: String) -> Interactor | |
} | |
class InteractorFactoryImpl { | |
let repository: TrackRepository | |
init(repository: TrackRepository) { | |
self.repository = repository |
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
class TrackSummaryViewEventHandler { | |
let interactorFactory: InteractorFactory | |
let presenterFactory: PresenterFactory | |
init(interactorFactory: InteractorFactory, presenterFactory: PresenterFactory) { | |
self.interactorFactory = interactorFactory | |
self.presenterFactory = presenterFactory | |
} | |
} |
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
protocol TrackSummaryViewObserver { | |
func viewShouldReloadData(view: TrackSummaryView) | |
func view(view: TrackSummaryView, didChangeTrackName name: String, forTrackWithID trackID: Int) | |
} |
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 TrackSummaryViewController: UIViewController { | |
let observer: TrackSummaryViewObserver | |
private var trackID: Int! | |
@IBOutlet private(set) var nameField: UITextField! | |
@IBOutlet private(set) var dateLabel: UILabel! | |
@IBOutlet private(set) var distanceLabel: UILabel! |
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
protocol TrackSummaryView: TrackSummaryPresenterOutput {} |
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
protocol TrackSummaryPresenterOutput { | |
func setTrackID(trackID: Int) | |
func setName(name: String) | |
func setDate(date: String) | |
func setDistance(distance: String) | |
} | |
class TrackSummaryPresenter { | |
let output: TrackSummaryPresenterOutput | |
private let dateFormatter: NSDateFormatter |