-
Notifications
You must be signed in to change notification settings - Fork 5
/
Test.cs
38 lines (31 loc) · 922 Bytes
/
Test.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Runtime.InteropServices;
namespace Testably.Abstractions.TestHelpers;
public class Test
{
public static bool IsNet7OrGreater
#if NET7_0_OR_GREATER
=> true;
#else
=> false;
#endif
public bool IsNetFramework { get; }
public bool RunsOnLinux { get; }
public bool RunsOnMac { get; }
public bool RunsOnWindows { get; }
public Test()
{
RunsOnLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
RunsOnMac = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
RunsOnWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
IsNetFramework = RuntimeInformation.FrameworkDescription
.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase);
}
public Test(OSPlatform osPlatform)
{
RunsOnLinux = osPlatform == OSPlatform.Linux;
RunsOnMac = osPlatform == OSPlatform.OSX;
RunsOnWindows = osPlatform == OSPlatform.Windows;
IsNetFramework = false;
}
}