Last active
December 8, 2015 14:24
-
-
Save eofster/39c670fc94e4776bfc6e to your computer and use it in GitHub Desktop.
GPS track summary presenter tests
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 | |
| import XCTest | |
| class TrackSummaryPresenterTests: XCTestCase { | |
| func testCallsOutputWithExpectedValues() { | |
| let outputSpy = TrackSummaryPresenterOutputSpy() | |
| let presenter = TrackSummaryPresenter(output: outputSpy) | |
| let track = TrackSummary(name: "Trip", startTime: 1449567617, distance: 200) | |
| presenter.update(track) | |
| XCTAssertEqual(outputSpy.invokedName, "Trip") | |
| XCTAssertEqual(outputSpy.invokedDate, "12/8/15") | |
| XCTAssertEqual(outputSpy.invokedDistance, "200.0 m") | |
| } | |
| } | |
| class TrackSummaryPresenterOutputSpy { | |
| private(set) var invokedName: String! | |
| private(set) var invokedDate: String! | |
| private(set) var invokedDistance: String! | |
| } | |
| extension TrackSummaryPresenterOutputSpy: TrackSummaryPresenterOutput { | |
| func setName(name: String) { | |
| invokedName = name | |
| } | |
| func setDate(date: String) { | |
| invokedDate = date | |
| } | |
| func setDistance(distance: String) { | |
| invokedDistance = distance | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment