I have references to arrays inside my Mock.Assert's expression statement which is causing the test to fail.
Here's my test that fails:
[TestMethod]public void JustMockTest_String_Arrays(){ // Arrange Mock.SetupStatic(typeof(System.IO.File)); string[] sourceFiles = new string[] { @"X:\source\file1.txt" }; string[] destinationFiles = new string[] { @"X:\destination\file1.txt" }; // Act System.IO.File.Copy(sourceFiles[0], destinationFiles[0]); // Assert Mock.Assert(() => System.IO.File.Copy(sourceFiles[0], destinationFiles[0]), Occurs.Once());}Though I noticed if I call the ToString() method, I can get the test to pass:
[TestMethod]public void JustMockTest_String_Arrays_ToString(){ // Arrange Mock.SetupStatic(typeof(System.IO.File)); string[] sourceFiles = new string[] { @"X:\source\file1.txt" }; string[] destinationFiles = new string[] { @"X:\destination\file1.txt" }; // Act System.IO.File.Copy(sourceFiles[0], destinationFiles[0]); // Assert Mock.Assert(() => System.IO.File.Copy(sourceFiles[0].ToString(), destinationFiles[0].ToString()), Occurs.Once());}