Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit fe03662

Browse files
authored
Fix svc test for nano (#19434)
1 parent 08d8c42 commit fe03662

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/SafeServiceControllerTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static void GetServices()
2727
case KeyIsoSvcName:
2828
foundKeyIsoSvc = true;
2929
Assert.False(string.IsNullOrEmpty(service.DisplayName), "string.IsNullOrEmpty(KeyIso.DisplayName)");
30-
Assert.True(service.CanStop, "KeyIso.CanStop");
30+
Assert.Equal(PlatformDetection.IsNotWindowsNanoServer, service.CanStop);
3131
Assert.False(service.CanPauseAndContinue, "KeyIso.CanPauseAndContinue");
3232
Assert.False(service.CanShutdown, "KeyIso.CanShutdown");
3333
Assert.Equal(ServiceType.Win32ShareProcess, service.ServiceType);
@@ -42,6 +42,11 @@ public static void GetServices()
4242
Assert.Equal(ServiceType.Win32ShareProcess, service.ServiceType);
4343
Assert.Equal(ServiceStartMode.Automatic, service.StartType);
4444
break;
45+
case "EVENTLOG":
46+
Assert.False(string.IsNullOrEmpty(service.DisplayName), "string.IsNullOrEmpty(EventLog.DisplayName)");
47+
Assert.True(service.CanStop, "EventLog.CanStop");
48+
Assert.True(service.CanShutdown, "EventLog.CanShutdown");
49+
break;
4550
default:
4651
foundOtherSvc = true;
4752
break;

src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/System.ServiceProcess.ServiceController.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
<Compile Include="$(CommonTestPath)\System\AssertExtensions.cs">
1414
<Link>Common\System\AssertExtensions.cs</Link>
1515
</Compile>
16+
<Compile Include="$(CommonTestPath)\System\PlatformDetection.cs">
17+
<Link>CommonTest\System\PlatformDetection.cs</Link>
18+
</Compile>
1619
</ItemGroup>
1720
<ItemGroup Condition="'$(TargetsWindows)'=='true' AND '$(Platform)'!='arm64'">
1821
<ProjectReference Include="..\System.ServiceProcess.ServiceController.TestNativeService\System.ServiceProcess.ServiceController.TestNativeService.vcxproj">

0 commit comments

Comments
 (0)