 
 // MARK: Internal location manager class
 
+/// A custom protocol to break the tight coupling of `LocationManager` and
+/// `CLLocationManager`.
+///
+/// Note: Creating instance properties for `coreLocationServicesEnabled` and
+/// `coreLocationAuthorizationStatus` allows them to be mocked more easily.
+protocol ELCLLocationManager: AnyObject {
+    /// A cover method for `CLLocationManager.locationServicesEnabled()`
+    var coreLocationServicesEnabled: Bool { get }
+    /// A cover method for `CLLocationManager.authorizationStatus()`
+    var coreLocationAuthorizationStatus: CLAuthorizationStatus { get }
+    var desiredAccuracy: CLLocationAccuracy { get set }
+    var distanceFilter: CLLocationDistance { get set }
+    weak var delegate: CLLocationManagerDelegate? { get set }
+    
+    func requestAlwaysAuthorization()
+    func requestWhenInUseAuthorization()
+    func startUpdatingLocation()
+    func stopUpdatingLocation()
+    func startMonitoringSignificantLocationChanges()
+    func stopMonitoringSignificantLocationChanges()
+}
+
+extension CLLocationManager: ELCLLocationManager {
+    var coreLocationServicesEnabled: Bool {
+        return CLLocationManager.locationServicesEnabled()
+    }
+    
+    var coreLocationAuthorizationStatus: CLAuthorizationStatus {
+        return CLLocationManager.authorizationStatus()
+    }
+}
+
 /**
 This is the internal class that is set up as a singleton that interfaces with `CLLocationManager` and adopts
 the protocols that define `ELLocation` services in the public API.

    
    // MARK: Properties, initializers and internal structures
    
    var manager: CLLocationManager
    private var allLocationListeners: [LocationListener]

    /// The current Core Location authorization status
    private var authorizationStatus: CLAuthorizationStatus {
        return CLLocationManager.authorizationStatus()
    }

    /// The accuracy, based on the current set of listener requests.

        }
    }

    override convenience init() {
        self.init(manager: CLLocationManager())
    }
    
    init(manager: ELCLLocationManager) {
        self.manager = manager
        self.allLocationListeners = [LocationListener]()
        super.init()
        manager.delegate = self
    }
