This is a function that I want to write a unit test for:

```
public object RequestAndSerializeJSON(string url, Type type) {
    var request = (HttpWebRequest)WebRequest.Create(url);
    request.Accept = "application/json";

    var response = request.GetResponse();
    using (var responseStream = response.GetResponseStream())
    {
        DataContractJsonSerializer serializer = new DataContractJsonSerializer(type);
        return serializer.ReadObject(responseStream);
    }
}

```

My first thought for testing this was to pass in a path to a file with test data in it for the url, but I can't do that because I'm casting it to an `HttpWebRequest` and it throws an error with a file path because it creates a `FileWebRequest` for file paths.

What is a good way to do this? I'm using the Visual Studio Test Tools for my testing.