Skip to content

Commit

Permalink
Re-enable System.IO.FileSystem.DriveInfoTests.DriveInfoUnixTests.Prop…
Browse files Browse the repository at this point in the history
…ertiesOfValidDrive on Android (#56462)

Contributes to #42548.

Based on akoeplinger's suggestion #42209 (comment)
  • Loading branch information
MaximLipnin authored Jul 28, 2021
1 parent 5d42771 commit fe4d5cf
Showing 1 changed file with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,30 @@ public void PropertiesOfInvalidDrive()
}

[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Android)]
[PlatformSpecific(TestPlatforms.AnyUnix)]
public void PropertiesOfValidDrive()
{
var root = new DriveInfo("/");
var format = root.DriveFormat;
Assert.Equal(PlatformDetection.IsBrowser ? DriveType.Unknown : DriveType.Fixed, root.DriveType);
Assert.True(root.IsReady);
Assert.Equal("/", root.Name);
Assert.Equal("/", root.ToString());
Assert.Equal("/", root.RootDirectory.FullName);
Assert.Equal("/", root.VolumeLabel);
var driveName = PlatformDetection.IsAndroid ? "/data" : "/";
var driveInfo = new DriveInfo(driveName);
var format = driveInfo.DriveFormat;
Assert.Equal(PlatformDetection.IsBrowser ? DriveType.Unknown : DriveType.Fixed, driveInfo.DriveType);
Assert.True(driveInfo.IsReady);
Assert.Equal(driveName, driveInfo.Name);
Assert.Equal(driveName, driveInfo.ToString());
Assert.Equal(driveName, driveInfo.RootDirectory.FullName);
Assert.Equal(driveName, driveInfo.VolumeLabel);

if (PlatformDetection.IsBrowser)
{
Assert.True(root.AvailableFreeSpace == 0);
Assert.True(root.TotalFreeSpace == 0);
Assert.True(root.TotalSize == 0);
Assert.True(driveInfo.AvailableFreeSpace == 0);
Assert.True(driveInfo.TotalFreeSpace == 0);
Assert.True(driveInfo.TotalSize == 0);
}
else
{
Assert.True(root.AvailableFreeSpace > 0);
Assert.True(root.TotalFreeSpace > 0);
Assert.True(root.TotalSize > 0);
Assert.True(driveInfo.AvailableFreeSpace > 0);
Assert.True(driveInfo.TotalFreeSpace > 0);
Assert.True(driveInfo.TotalSize > 0);
}
}

Expand Down

0 comments on commit fe4d5cf

Please sign in to comment.