Skip to content

Commit e9d08de

Browse files
committed
🔧 Fix(Test): help command does not exist on other platforms, use other commands to replace.
1 parent 0934df5 commit e9d08de

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

‎Common.BasicHelper.Test/Core/Shell/CommandsExecutor_Tests.cs‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,26 @@ public class CommandsExecutor_Tests
66
[TestMethod]
77
public void Test_ExecuteAsCommand()
88
{
9-
Console.WriteLine("help".ExecuteAsCommand());
9+
if (OperatingSystem.IsWindows())
10+
Console.WriteLine("help".ExecuteAsCommand());
11+
12+
if (OperatingSystem.IsLinux())
13+
Console.WriteLine("apt".ExecuteAsCommand("-v"));
14+
15+
if (OperatingSystem.IsMacOS())
16+
Console.WriteLine("sw_vers".ExecuteAsCommand());
1017
}
1118

1219
[TestMethod]
1320
public async Task Test_ExecuteAsCommandAsync()
1421
{
15-
Console.WriteLine(await "help".ExecuteAsCommandAsync());
22+
if (OperatingSystem.IsWindows())
23+
Console.WriteLine(await "help".ExecuteAsCommandAsync());
24+
25+
if (OperatingSystem.IsLinux())
26+
Console.WriteLine(await "apt".ExecuteAsCommandAsync("-v"));
27+
28+
if (OperatingSystem.IsMacOS())
29+
Console.WriteLine(await "sw_vers".ExecuteAsCommandAsync());
1630
}
1731
}

0 commit comments

Comments
 (0)