-
Notifications
You must be signed in to change notification settings - Fork 266
Closed
Labels
area: testinghelpersIssues that address the testing helpersIssues that address the testing helpersstate: needs discussionIssues that need further discussionIssues that need further discussionstate: staletype: bugIssues that describe misbehaving functionalityIssues that describe misbehaving functionality
Description
The MockDriveInfo type allows the caller to set various properties on instances of the class (e.g. AvailableFreeSpace or DriveType), but these properties are not included in the objects output by a call to MockFileSystem.DriveInfo.GetDrives() since the array is built from the list of files in the mock without checking if a MockDriveInfo object is defined.
Creating the mock
var fileSystem = new MockFileSystem();
fileSystem.AddFile(@"C:\path\to\file.txt", MockFileData.NullObject);
var driveInfo = new MockDriveInfo(fileSystem, "c:") { DriveType = DriveType.Fixed };Checking the drive is local
List<string> localDiskDrives =
(
from driveInfo in fileSystem.DriveInfo.GetDrives()
where driveInfo.DriveType == DriveType.Fixed & driveInfo.IsReady
select driveInfo.RootDirectory.ToString()
).ToList();Expected
List containing "c:"
Actual
Empty list
Metadata
Metadata
Assignees
Labels
area: testinghelpersIssues that address the testing helpersIssues that address the testing helpersstate: needs discussionIssues that need further discussionIssues that need further discussionstate: staletype: bugIssues that describe misbehaving functionalityIssues that describe misbehaving functionality