URLSessionElegate方法的单元测试-Swift
我有一个名为URLSessionElegate方法的单元测试-Swift,swift,xcode,unit-testing,urlsession,urlauthenticationchallenges,Swift,Xcode,Unit Testing,Urlsession,Urlauthenticationchallenges,我有一个名为CertificatePinningDelegate的自定义委托类,它符合URLSessionDelegate。我正在使用委托方法 urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)
CertificatePinningDelegate
的自定义委托类,它符合URLSessionDelegate
。我正在使用委托方法
urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)
向服务器进行身份验证。现在我想为此编写一个单元测试
我一直在尝试手动调用委托方法来传递一个自定义的URLAuthenticationChallenge
对象,这似乎是不可能的。有人知道这方面的其他/更好的选择吗