import XCTest
import CoreLocation
@testable import columbus

final class UTMCreateLocationDelegate:XCTestCase
{
    private let kAccuracy:CLLocationAccuracy = kCLLocationAccuracyBestForNavigation
    
    //MARK: tests
    
    func testAskAuthorization()
    {
        let model:MCreateLocationDelegate = MCreateLocationDelegate()
        model.askAuthorization()
        
        XCTAssertNotNil(
            model.locationManager,
            "failed creating location manager")
        
        XCTAssertNotNil(
            model.locationManager?.delegate,
            "failed assigning delegate to location manager")
        
        XCTAssertEqual(
            model.locationManager?.desiredAccuracy,
            kAccuracy,
            "failed assigning maximum accuracy for location manager")
    }
    
    func testClean()
    {
        let model:MCreateLocationDelegate = MCreateLocationDelegate()
        model.askAuthorization()
        model.clean()
        
        XCTAssertNil(
            model.locationManager?.delegate,
            "failed removing delegate from location manager")
    }
}

import XCTest
import CoreLocation
@testable import columbus

final class UTMCreateLocationDelegate:XCTestCase
{
    private var modelLocation:MCreateLocationDelegate?
    private var modelCreate:MCreate?
    private let kAccuracy:CLLocationAccuracy = kCLLocationAccuracyBestForNavigation
    
    override func setUp()
    {
        super.setUp()
        
        modelLocation = MCreateLocationDelegate()
        modelCreate = MCreate()
        modelLocation?.model = modelCreate
        modelLocation?.askAuthorization()
    }
    
    //MARK: tests
    
    func testAskAuthorization()
    {
        XCTAssertNotNil(
            modelLocation?.locationManager,
            "failed creating location manager")
        
        XCTAssertNotNil(
            modelLocation?.locationManager?.delegate,
            "failed assigning delegate to location manager")
        
        XCTAssertEqual(
            modelLocation?.locationManager?.desiredAccuracy,
            kAccuracy,
            "failed assigning maximum accuracy for location manager")
    }
    
    func testClean()
    {
        modelLocation?.clean()
        
        XCTAssertNil(
            modelLocation?.locationManager?.delegate,
            "failed removing delegate from location manager")
    }
}

Use setup in test to init models
Use setup in test to init models
