         validateAdvertisingUpdate(delegateMock.advertisingListeningState, advertising: false,
                                   browsing: true)
     }
-
+    
     func testStartAdvertisingAndListeningInvokePeerAvailabilityChangedForDifferentContexts() {
         do {
             let foundPeerFromAnotherContextExpectation =

        }
    }
    @objc func context(context: AppContext, didUpdateDiscoveryAdvertisingState
                       discoveryAdvertisingState: String) {
        advertisingListeningState = discoveryAdvertisingState
    }
    @objc func context(context: AppContext, didFailIncomingConnectionToPort port: UInt16) {}

        XCTAssertEqual(advertisingActive, advertising)
        XCTAssertEqual(listeningActive, browsing)
    }
    
    func testWillEnterBackground() {
        let delegateMock = AppContextDelegateMock(peerAvailabilityChangedHandler: { _ in
            XCTFail("unexpected peerAvailabilityChanged event")
        })
        context.delegate = delegateMock
        NSNotificationCenter.defaultCenter()
            .postNotificationName(UIApplicationWillResignActiveNotification,
                                  object: nil)
        XCTAssertTrue(delegateMock.willEnterBackground)
    }
    
    func testDidEnterForeground() {
        let delegateMock = AppContextDelegateMock(peerAvailabilityChangedHandler: { _ in
            XCTFail("unexpected peerAvailabilityChanged event")
        })
        context.delegate = delegateMock
        NSNotificationCenter.defaultCenter()
            .postNotificationName(UIApplicationDidBecomeActiveNotification,
                                  object: nil)
        XCTAssertTrue(delegateMock.didEnterForeground)
    }
    
    func testDidRegisterToNative() {
        var error: ErrorType?
        do {
