KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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. Additional information: I tried creating a fake HttpResponse object by passing in a StringWriter. StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); HttpResponse response = new HttpResponse(sw); RssGenerator.Generate(response, otherParameters); The test fails with the message: System.Web.HttpException: OutputStream is not available when a custom TextWriter is used. 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.
Tags (comma-separated)
Save Edits
Cancel