 class MockCLLocationManager: ELCLLocationManager {
     var coreLocationServicesEnabled: Bool = true
     var coreLocationAuthorizationStatus: CLAuthorizationStatus = .NotDetermined
-    var requestedAuthorizationStatus: CLAuthorizationStatus? = nil
+    var requestedAuthorization: LocationAuthorization? = nil
 
     var desiredAccuracy: CLLocationAccuracy = kCLLocationAccuracyBest
     var distanceFilter: CLLocationDistance = kCLDistanceFilterNone

    }

    func requestAlwaysAuthorization() {
        requestedAuthorizationStatus = .AuthorizedAlways
    }

    func requestWhenInUseAuthorization() {
        requestedAuthorizationStatus = .AuthorizedWhenInUse
    }
    
    func startUpdatingLocation() {

    }
    
    // MARK: Request authorization

    func testRequestAuth() {
        for servicesEnabled in [true, false] {
            for authorizationStatus: CLAuthorizationStatus in [.NotDetermined, .Denied, .Restricted, .AuthorizedWhenInUse, .AuthorizedAlways] {
                for authorization: LocationAuthorization in [.WhenInUse, .Always] {
                    testRequestAuth(servicesEnabled: servicesEnabled, authorizationStatus: authorizationStatus, authorization: authorization)
                }
            }
        }
    }

    func testRequestAuth(servicesEnabled servicesEnabled: Bool, authorizationStatus: CLAuthorizationStatus, authorization: LocationAuthorization) {
        let manager = MockCLLocationManager()
        let provider = LocationManager(manager: manager)
        let subject = LocationAuthorizationService(locationAuthorizationProvider: provider)

        manager.withMockServicesEnabled(servicesEnabled) {
            manager.withMockAuthorizationStatus(authorizationStatus) {
                let error = subject.requestAuthorization(authorization)

                switch (servicesEnabled, authorizationStatus, authorization) {
                case (false, _, _):
                    XCTAssertNotNil(error, "Request auth returns error when location services are disabled")
                case (true, .Denied, _):
                    XCTAssertNotNil(error, "Request auth returns error when authorization is denied")
                case (true, .Restricted, _):
                    XCTAssertNotNil(error, "Request auth returns error when authorization is restricted")
                case (true, .NotDetermined, _):
                    XCTAssertNil(error, "Request auth does not return error when authorization is undetermined")
                    XCTAssertEqual(manager.requestedAuthorization, authorization, "Requests auth when necessary")
                case (true, .AuthorizedWhenInUse, .WhenInUse),
                     (true, .AuthorizedAlways,    .Always):
                    XCTAssertNil(error, "Request auth does not return error already authorized")
                    XCTAssertNil(manager.requestedAuthorization, "Request auth does nothing when already authorized")
                case (true, .AuthorizedWhenInUse, .Always),
                     (true, .AuthorizedAlways,    .WhenInUse):
                    XCTAssertNotNil(error, "Request auth returns error when existing authorization does not match requested authorization")
                    XCTAssertNil(manager.requestedAuthorization, "Request auth does nothing when existing authorization does not match requested authorization")
                }
            }
        }
    }

    // MARK: Location Updates

    func testLocationMonitoring() {
