I'm using the Trial Edition and am just getting started with JustMock. Previously I was using Moq, and am looking at your features for mocking sealed classes, etc.
I have a question about mocking FileInfo properties like LastWriteTimeUtc. I saw how you mocked FileInfo methods in the example.
Initially, I tried mocking FileSystemInfo, an abstract class, using an approach like this:
My issue is that although the Name and FullName properties are set, LastWriteTimeUtc is not set, and retains its default value.
I also tried mocking FileInfo by changing the constructor to look like this, but it was not effective either. Do you have some advice?
I have a question about mocking FileInfo properties like LastWriteTimeUtc. I saw how you mocked FileInfo methods in the example.
Initially, I tried mocking FileSystemInfo, an abstract class, using an approach like this:
[TestMethod] public void Can_Determine_Todays_File_By_LastWrite() { var mockFile = Mock.Create<FileSystemInfo>(); Mock.Arrange(() => mockFile.FullName).Returns("c:\\MSGTRK20111001-1.log"); Mock.Arrange(() => mockFile.Name).Returns("MSGTRK20111001-1.log"); Mock.Arrange(() => mockFile.LastWriteTimeUtc).Returns(DateTime.UtcNow); var result = FileRoutines.IsTodaysFile(mockFile); Assert.IsTrue(result); }My issue is that although the Name and FullName properties are set, LastWriteTimeUtc is not set, and retains its default value.
I also tried mocking FileInfo by changing the constructor to look like this, but it was not effective either. Do you have some advice?
var mockFile = Mock.Create<FileInfo>("c:\\MSGTRK20111001-1.log");