title: Unit test for a method that takes a HttpResponse object as a parameter. OutputStream is not available
body: <p>I am trying to create a unit test for a method that takes a HttpResponse object as a parameter.  What the correct way of doing this?  I hope you seasoned unit testers out there can help me.  </p>
  
  <p><strong>Additional information:</strong>
  I tried creating a fake HttpResponse object by passing in  a StringWriter.  </p>
  
  <pre><code>StringBuilder sb = new StringBuilder();
  StringWriter sw = new StringWriter(sb);
  HttpResponse response = new HttpResponse(sw);
  RssGenerator.Generate(response, otherParameters);
  </code></pre>
  
  <p>The test fails with the message:  <em>System.Web.HttpException: OutputStream is not available when a custom TextWriter is used.</em>   The method being tested is part of a class library dll.  It uses the Response object's OutputStream to create an RSSFeed with an XMLWriter.  </p>