public void MockFile_SetLastWriteTimeUtc_ShouldAffectLastWriteTime() { // Arrange string path = XFS.Path(@"c:\something\demo.txt"); var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { path, new MockFileData("Demo text content") } }); var file = new MockFile(fileSystem); // Act var lastWriteTime = new DateTime(2010, 6, 4, 13, 26, 42); file.SetLastWriteTimeUtc(path, lastWriteTime.ToUniversalTime()); var result = file.GetLastWriteTime(path); // Assert Assert.AreEqual(lastWriteTime, result); }
public void MockFile_GetSetLastWriteTime_ShouldPersist() { // Arrange string path = XFS.Path(@"c:\something\demo.txt"); MockFileSystem fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { path, new MockFileData("Demo text content") } }); MockFile file = new MockFile(fileSystem); // Act DateTime lastWriteTime = new DateTime(2010, 6, 4, 13, 26, 42); file.SetLastWriteTime(path, lastWriteTime); DateTime result = file.GetLastWriteTime(path); // Assert Assert.Equal(lastWriteTime, result); }
public void MockFile_SetLastWriteTimeUtc_ShouldAffectLastWriteTime() { // Arrange const string path = @"c:\something\demo.txt"; var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData> { { path, new MockFileData("Demo text content") } }); var file = new MockFile(fileSystem); // Act var lastWriteTime = new DateTime(2010, 6, 4, 13, 26, 42); file.SetLastWriteTimeUtc(path, lastWriteTime.ToUniversalTime()); var result = file.GetLastWriteTime(path); // Assert Assert.AreEqual(lastWriteTime, result); }
public void MockFile_GetSetLastWriteTime_ShouldPersist() { // Arrange string path = XFS.Path(@"c:\something\demo.txt"); var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData> { { path, new MockFileData("Demo text content") } }); var file = new MockFile(fileSystem); // Act var lastWriteTime = new DateTime(2010, 6, 4, 13, 26, 42); file.SetLastWriteTime(path, lastWriteTime); var result = file.GetLastWriteTime(path); // Assert Assert.AreEqual(lastWriteTime, result); }