diff --git a/src/OpenCvSharp/Internal/PInvoke/WindowsLibraryLoader.cs b/src/OpenCvSharp/Internal/PInvoke/WindowsLibraryLoader.cs index ac22313cd..ee638c8f0 100644 --- a/src/OpenCvSharp/Internal/PInvoke/WindowsLibraryLoader.cs +++ b/src/OpenCvSharp/Internal/PInvoke/WindowsLibraryLoader.cs @@ -84,7 +84,7 @@ public bool IsLibraryLoaded(string dllName) } /// - /// + /// Determine if the OS is Windows /// /// public static bool IsCurrentPlatformSupported() @@ -98,7 +98,7 @@ public static bool IsCurrentPlatformSupported() } /// - /// + /// Determine if the runtime is .NET Core /// /// public static bool IsDotNetCore() @@ -107,7 +107,8 @@ public static bool IsDotNetCore() return false; #else // https://github.com/dotnet/corefx/blob/v2.1-preview1/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.cs - return RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.Ordinal); + return Environment.Version.Major >= 5 || + RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase); #endif } diff --git a/test/OpenCvSharp.Tests/AppDomainTest.cs b/test/OpenCvSharp.Tests/system/AppDomainTest.cs similarity index 100% rename from test/OpenCvSharp.Tests/AppDomainTest.cs rename to test/OpenCvSharp.Tests/system/AppDomainTest.cs diff --git a/test/OpenCvSharp.Tests/ExceptionTest.cs b/test/OpenCvSharp.Tests/system/ExceptionTest.cs similarity index 100% rename from test/OpenCvSharp.Tests/ExceptionTest.cs rename to test/OpenCvSharp.Tests/system/ExceptionTest.cs diff --git a/test/OpenCvSharp.Tests/SaturateCastTest.cs b/test/OpenCvSharp.Tests/system/SaturateCastTest.cs similarity index 100% rename from test/OpenCvSharp.Tests/SaturateCastTest.cs rename to test/OpenCvSharp.Tests/system/SaturateCastTest.cs diff --git a/test/OpenCvSharp.Tests/StdStringTest.cs b/test/OpenCvSharp.Tests/system/StdStringTest.cs similarity index 100% rename from test/OpenCvSharp.Tests/StdStringTest.cs rename to test/OpenCvSharp.Tests/system/StdStringTest.cs diff --git a/test/OpenCvSharp.Tests/VectorTest.cs b/test/OpenCvSharp.Tests/system/VectorTest.cs similarity index 100% rename from test/OpenCvSharp.Tests/VectorTest.cs rename to test/OpenCvSharp.Tests/system/VectorTest.cs diff --git a/test/OpenCvSharp.Tests/system/WindowsLibraryLoaderTest.cs b/test/OpenCvSharp.Tests/system/WindowsLibraryLoaderTest.cs new file mode 100644 index 000000000..9b5196ae7 --- /dev/null +++ b/test/OpenCvSharp.Tests/system/WindowsLibraryLoaderTest.cs @@ -0,0 +1,22 @@ +#nullable enable + +using OpenCvSharp.Internal; +using Xunit; + +namespace OpenCvSharp.Tests +{ + public class WindowsLibraryLoaderTest + { + [Fact] + public void IsDotNetCore() + { +#if NET48 + Assert.False(WindowsLibraryLoader.IsDotNetCore()); +#elif NETCOREAPP3_1_OR_GREATER + Assert.True(WindowsLibraryLoader.IsDotNetCore()); +#else + throw new OpenCvSharpException("Unexpected environment."); +#endif + } + } +} \ No newline at end of file