Last active
April 18, 2020 19:31
-
-
Save cipolleschi/0f67e3a59e28ed0d589952ae1c90576b to your computer and use it in GitHub Desktop.
Load content test
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 | |
| import Foundation | |
| /// File manager stub to override the methods we need | |
| class FileManagerStub: FileManager { | |
| override func getContent(atPath: Stirng) -> Data? { | |
| return Data() | |
| } | |
| } | |
| /// Class under test | |
| class MyViewControllerTest: XCTestCase { | |
| func testLoadContent_withEmptyFile() { | |
| let vc = MyViewController() | |
| let fileManagerStub = FileManagerStub() | |
| let decoder: JSONDecoder = JSONDecoder() | |
| vc.loadContent(fileManager: fileManagerStub, path: "emptyFile", jsonDecoder: decoder) | |
| XCTAssertTrue(vc.content.isEmpty) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment