chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
I'm trying to mock or otherwise verify following code. I cannot use fakes so what option I have?

MyReport report = new MyReport();
String fileName = "C:\myReport.txt";

using (StreamWriter writer = new StreamWriter(fileName))
{
   XmlSerializer serializer = new XmlSerializer(typeof(MyReport));
   serializer.Serialize(writer, report);
   writer.Close();
}
asked by JK (3.1k points)

1 Answer

0 votes
We will examine here if we can add support for StreamWriter.

For now, one option would be to wrap your code in another class, such as MyStreamWriter, which you can then use with isolator.

Or, accept the stream as an argument, and in your tests send in MemoryStream that you can then examine for correctness.
answered by yoel (1.9k points)
...