Last active
January 26, 2021 14:28
-
-
Save Kdan/4d724be1ccdccfca32a9ba63c0219eb5 to your computer and use it in GitHub Desktop.
This file contains 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 PresenterMock: Mock<PresenterMock.Functions>, Presenter { | |
enum Functions: FunctionName { | |
case present = "present(title:description:)" | |
} | |
func present(title: String, description: String) { log(parameters: (title, description)) } | |
} | |
/* In the ContentHandlerTests */ | |
func testHandlePositiveInput() { | |
handler.handleInput(5) | |
let function = presenterMock.calls(with: .present) | |
XCTAssertNotNil(function) | |
XCTAssertEqual(function?.numberOfCalls, 1) | |
let parameters = function?.calls.last as? (String, String) | |
XCTAssertEqual(parameters?.0, "Positive") | |
XCTAssertEqual(parameters?.1, "Great input") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment