func testCreateQueryParameters_withoutFormattedAddresses()

in source/UberRidesTests/RequestURLUtilTests.swift [154:195]


    func testCreateQueryParameters_withoutFormattedAddresses() {
        
        let testPickupLocation = CLLocation(latitude: 32.0, longitude: -32.0)
        let testDropoffLocation = CLLocation(latitude: 62.0, longitude: -62.0)
        let testPickupNickname = "testPickup"
        let testDropoffNickname = "testDropoff"
        let testProductID = "test ID"
        let testSource = "test source"
        let expectedUserAgent = "\(baseUserAgent!)-\(testSource)"
        
        let pickupLatitudeQueryItem = URLQueryItem(name: "pickup[latitude]", value: "\(testPickupLocation.coordinate.latitude)")
        let pickupLongitudeQueryItem = URLQueryItem(name: "pickup[longitude]", value: "\(testPickupLocation.coordinate.longitude)")
        let pickupNicknameQueryItem = URLQueryItem(name: "pickup[nickname]", value: testPickupNickname)
        
        let dropoffLatitudeQueryItem = URLQueryItem(name: "dropoff[latitude]", value: "\(testDropoffLocation.coordinate.latitude)")
        let dropoffLongitudeQueryItem = URLQueryItem(name: "dropoff[longitude]", value: "\(testDropoffLocation.coordinate.longitude)")
        let dropoffNicknameQueryItem = URLQueryItem(name: "dropoff[nickname]", value: testDropoffNickname)
        
        let productIdQueryItem = URLQueryItem(name: "product_id", value: testProductID)
        let clientIdQueryItem = URLQueryItem(name: "client_id", value: "testClientID")
        let userAgentQueryItem = URLQueryItem(name: "user-agent", value: expectedUserAgent)
        let actionQueryItem = URLQueryItem(name: "action", value: "setPickup")
        
        let expectedQueryParameters = [pickupLatitudeQueryItem, pickupLongitudeQueryItem, pickupNicknameQueryItem,
                                       dropoffLatitudeQueryItem, dropoffLongitudeQueryItem, dropoffNicknameQueryItem,
                                       productIdQueryItem, clientIdQueryItem, userAgentQueryItem, actionQueryItem]

        let parameters = RideParametersBuilder()
        parameters.pickupLocation = testPickupLocation
        parameters.dropoffLocation = testDropoffLocation
        parameters.pickupNickname = testPickupNickname
        parameters.dropoffNickname = testDropoffNickname
        parameters.productID = testProductID
        parameters.source = testSource
        
        let comparisonSet = NSSet(array: expectedQueryParameters)
        
        let testQueryParameters = RequestURLUtil.buildRequestQueryParameters(parameters.build())
        let testComparisonSet = NSSet(array:testQueryParameters)
        
        XCTAssertEqual(comparisonSet, testComparisonSet)
    }