Skip to content

Commit

Permalink
address code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsitnik authored and github-actions committed Jun 25, 2021
1 parent 19d9ee5 commit 438aea4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public static partial class PlatformDetection
public static bool IsNotWindowsHomeEdition => !IsWindowsHomeEdition;
public static bool IsNotInAppContainer => !IsInAppContainer;
public static bool IsSoundPlaySupported => IsWindows && IsNotWindowsNanoServer;
public static bool IsAdmin_IsNotNano => PlatformDetection.IsWindowsAndElevated && PlatformDetection.IsNotWindowsNanoServer;

// >= Windows 10 Anniversary Update
public static bool IsWindows10Version1607OrGreater => IsWindowsVersionOrLater(10, 0, 14393);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected override string GetTestFilePath(int? index = null, [CallerMemberName]

// instead of:
// 'C:\Users\x\AppData\Local\Temp\y\z
// we want sth like:
// we want something like:
// '\\.\Volume{724edb31-eaa5-4728-a4e3-f2474fd34ae2}\Users\x\AppData\Local\Temp\y\z
string devicePath = filePath.Replace(drive, volumeNameBuffer.ToString());
Assert.StartsWith(@"\\?\", devicePath);
Expand All @@ -78,25 +78,24 @@ protected override string GetTestFilePath(int? index = null, [CallerMemberName]
[PlatformSpecific(TestPlatforms.Windows)] // the test setup is Windows-specifc
[Collection("NoParallelTests")] // don't run in parallel, as file sharing logic is not thread-safe
[OuterLoop("Requires admin privileges to create a file share")]
[ConditionalClass(typeof(UncFilePathFileStreamStandaloneConformanceTests), nameof(UncFilePathFileStreamStandaloneConformanceTests.CanShareFiles))]
[ConditionalClass(typeof(UncFilePathFileStreamStandaloneConformanceTests), nameof(CanShareFiles))]
public class UncFilePathFileStreamStandaloneConformanceTests : UnbufferedAsyncFileStreamStandaloneConformanceTests
{
public static bool CanShareFiles
public static bool CanShareFiles => _canShareFiles.Value;

private static Lazy<bool> _canShareFiles = new Lazy<bool>(() =>
{
get
if (!PlatformDetection.IsWindowsAndElevated || PlatformDetection.IsWindowsNanoServer)
{
if (!PlatformDetection.IsAdmin_IsNotNano)
{
return false;
}
return false;
}

// the "Server Service" allows for file sharing. It can be disabled on some of our CI machines.
using (ServiceController sharingService = new ServiceController("Server"))
{
return sharingService.Status == ServiceControllerStatus.Running;
}
// the "Server Service" allows for file sharing. It can be disabled on some of our CI machines.
using (ServiceController sharingService = new ServiceController("Server"))
{
return sharingService.Status == ServiceControllerStatus.Running;
}
}
});

protected override string GetTestFilePath(int? index = null, [CallerMemberName] string memberName = null, [CallerLineNumber] int lineNumber = 0)
{
Expand Down

0 comments on commit 438aea4

Please sign in to comment.