mirror of https://github.com/SixLabors/ImageSharp
2 changed files with 0 additions and 63 deletions
@ -1,32 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Six Labors Split License.
|
|||
|
|||
using System; |
|||
using System.Runtime.InteropServices; |
|||
|
|||
namespace SixLabors.ImageSharp |
|||
{ |
|||
/// <summary>
|
|||
/// Provides information about the .NET runtime installation.
|
|||
/// Many methods defer to <see cref="RuntimeInformation"/> when available.
|
|||
/// </summary>
|
|||
internal static class RuntimeEnvironment |
|||
{ |
|||
private static readonly Lazy<bool> IsNetCoreLazy = new Lazy<bool>(() => FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase)); |
|||
|
|||
/// <summary>
|
|||
/// Gets a value indicating whether the .NET installation is .NET Core 3.1 or lower.
|
|||
/// </summary>
|
|||
public static bool IsNetCore => IsNetCoreLazy.Value; |
|||
|
|||
/// <summary>
|
|||
/// Gets the name of the .NET installation on which an app is running.
|
|||
/// </summary>
|
|||
public static string FrameworkDescription => RuntimeInformation.FrameworkDescription; |
|||
|
|||
/// <summary>
|
|||
/// Indicates whether the current application is running on the specified platform.
|
|||
/// </summary>
|
|||
public static bool IsOSPlatform(OSPlatform osPlatform) => RuntimeInformation.IsOSPlatform(osPlatform); |
|||
} |
|||
} |
|||
@ -1,31 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Six Labors Split License.
|
|||
|
|||
using System.Runtime.InteropServices; |
|||
using Xunit; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.Helpers |
|||
{ |
|||
public class RuntimeEnvironmentTests |
|||
{ |
|||
[Fact] |
|||
public void CanDetectNetCore() => Assert.False(RuntimeEnvironment.IsNetCore); |
|||
|
|||
[Fact] |
|||
public void CanDetectOSPlatform() |
|||
{ |
|||
if (TestEnvironment.IsLinux) |
|||
{ |
|||
Assert.True(RuntimeEnvironment.IsOSPlatform(OSPlatform.Linux)); |
|||
} |
|||
else if (TestEnvironment.IsMacOS) |
|||
{ |
|||
Assert.True(RuntimeEnvironment.IsOSPlatform(OSPlatform.OSX)); |
|||
} |
|||
else if (TestEnvironment.IsWindows) |
|||
{ |
|||
Assert.True(RuntimeEnvironment.IsOSPlatform(OSPlatform.Windows)); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue