Skip to content

Incorrect LastAccessTime & LastWriteTime for directory #839

@CzBuCHi

Description

@CzBuCHi

Describe the bug
Mock file system is not storing LastAccessTime & LastWriteTime properties for directories

To Reproduce

var fileSystem = new MockFileSystem();
var info = fileSystem.DirectoryInfo.FromDirectoryName(@"C:\\Parent\\Dir");
info.Create();
info.LastWriteTime = new DateTime(2001, 2, 3);

var c= fileSystem.DirectoryInfo.FromDirectoryName("C:\\Parent");
foreach (var info in parent.EnumerateDirectories()) {
   var thisShouldBeTrue = info.LastAccessTime  == new DateTime(2001, 2, 3);
}

Expected behavior
variable thisShouldBeTrue should be true.

Additional context
class MockFileSystem should have method AddDirectory(string path, MockDirectoryInfo mock) so i can set directory attributes same way as in method AddFile. MockDirectoryInfo is derived from MockFileInfo but with no content (only default ctor) and with attribute FileAttributes.Directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: testinghelpersIssues that address the testing helpersstate: ready to pickIssues that are ready for being worked ontype: bugIssues that describe misbehaving functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions