Hi,
I want to mock the StreamReader constructor below so the unit test can pass that statement without failing. All the samples of mocking mscorlib relies on mocking a method, but I want to mock the constructor, how do I do that?
I don't want to create a valid file and pass a valid pathToFile.
We are currently using version 2013.1.507, please provide a sample that works on this version.
Thanks,
Gustavo
public class MyClass
{
public static string DoSomething(string pathToFile)
{
TextReader xmlTextReader = new StreamReader(pathToFile);
//some method logic
//returns a string
}
}