I have a server class, that fetches files from Internet using
, and fetches files from the disk drive (
). I have several functions, whose jobs are to return an open stream, whether it's an open file, or an Internet resource. How should I unit-test these functions to know that they are returning what they should? Or, in general, how should I unit-test methods that access outside sources (whether it's a database or socket connection)?