Unfortunately, this is not possible with JustMock 2013.1.507.
A possible solution is to extract the construction of your "
" into another method, like this:
TextReader xmlTextReader =
TextReader xmlTextReader = MyXMLTextReader(pathToFile);
//some method logic
//returns a string
Then, you will be able to arrange against "
Mock.Arrange(() => MyClass.MyXMLTextReader(Arg.AnyString)).DoNothing();
Note, you could also arrange its return value as desired. Finally, you will be able to call the "
" method no matter the string passed as argument.
However, in the latest internal builds we have included the Future Constructor Mocking
feature. This will let you future mock the constructor of an instance (even to a MsCorlib member), the following way:
With this approach, no refactoring to your existing system under test will be necessary.
I hope this helps.
Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums
, or our JustTrace