Possible Duplicate:
.NET file system wrapper library
I would like to write a test where the content of a file get's loaded. In the example the class which is used to load the content is
FileClass
and the method
GetContentFromFile(string path).
Is there any way to mock the
File.exists(string path)
method in the given example with moq?
Example:
I have a class with a method like that:
public class FileClass
{
public string GetContentFromFile(string path)
{
if (File.exists(path))
{
//Do some more logic in here...
}
}
}