I have a bunch of classes that all implement an Interface and one of the parameters is a StreamWriter.
I need to check the contents of the StreamWriter.
I am trying to find a way to avoid writing text files on the test server and opening them to check the contents.
Is there is a way to quickly convert the StreamWriter contents/stream to a StringBuilder variable?
You cannot check the
StreamWriter. You could check the underlying stream it is writing to. So you could use aMemoryStreamin your unit test and point thisStreamWriterto it. Once it has finished writing you could read from it.