Last active
December 7, 2018 12:30
-
-
Save Juanpe/717feef9ca2bf5dbdd8db62ca9c32e71 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 ViewControllerWithoutCLTests: XCTestCase { | |
var sut: ViewControllerWithoutCL! | |
var locationProvider: UserLocationProviderMock! | |
override func setUp() { | |
super.setUp() | |
locationProvider = UserLocationProviderMock() | |
sut = ViewControllerWithoutCL(locationProvider: locationProvider) | |
} | |
override func tearDown() { | |
sut = nil | |
locationProvider = nil | |
super.tearDown() | |
} | |
func testRequestUserLocation_NotAuthorized_ShouldFail() { | |
// Given | |
locationProvider.locationBlockLocationValue = UserLocationMock() | |
locationProvider.locationBlockErrorValue = UserLocationError.canNotBeLocated | |
// When | |
sut.requestUserLocation() | |
// Then | |
XCTAssertNil(sut.userLocation) | |
} | |
func testRequestUserLocation_Authorized_ShouldReturnUserLocation() { | |
// Given | |
locationProvider.locationBlockLocationValue = UserLocationMock() | |
// When | |
sut.requestUserLocation() | |
// Then | |
XCTAssertNotNil(sut.userLocation) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment