vendredi 26 juin 2015

Unit testing a class that uses NSURLSession in Swift

I am looking for the most effective way to unit test a class that uses NSURLSession to retrieve data from a URL. I have seen older examples of classes that implement the NSURLConnectionDelegate protocol. From reading the NSURLSession class reference documentation, to use the same approach my class would have to implement the NSURLSessionDataDelegate protocol. This I believe will also require implementing the NSURLSessionTaskDelegate and NSURLSessionDelegate protocols, which together contain a number of methods that I don't need.

Is there a simpler way to accomplish the same objective?

Thanks.

Aucun commentaire:

Enregistrer un commentaire