This test method was working in 8.8 but isn't in 9.1.2, not sure what changed - or more specifically what is the correct way? Here is a sample test - it only fails to verify the close was called on the file stream:
[TestMethod]
public void TestMethod1()
{
FileStream fakeFs = Isolate.Fake.AllInstances<FileStream>();
Isolate.WhenCalled(() => File.Open("", FileMode.Create)).DoInstead((context) =>
{
string path = context.Parameters[0] as string;
return new FileStream(path, FileMode.Create);
});
Isolate.WhenCalled(() => fakeFs.Close()).DoInstead((context) =>
{
Debug.WriteLine("place holder");
});
Isolate.WhenCalled(() => File.Delete("")).IgnoreCall();
string directoryName = Directory.GetCurrentDirectory();
string testFile = Path.Combine(directoryName, "Testfile808.txt");
FileStream fs = File.Open(testFile, FileMode.Create);
fs.Close();
File.Delete(testFile);
Isolate.Verify.WasCalledWithAnyArguments(() => File.Open("", FileMode.Create));
Isolate.Verify.WasCalledWithAnyArguments(() => File.Delete(""));
Isolate.Verify.WasCalledWithAnyArguments(() => fakeFs.Close());
}