diff --git a/src/Test/BouncyHsm.Pkcs11IntegrationTests/AssemblyTestConstants.cs b/src/Test/BouncyHsm.Pkcs11IntegrationTests/AssemblyTestConstants.cs index 9df6534..b41c11b 100644 --- a/src/Test/BouncyHsm.Pkcs11IntegrationTests/AssemblyTestConstants.cs +++ b/src/Test/BouncyHsm.Pkcs11IntegrationTests/AssemblyTestConstants.cs @@ -1,8 +1,26 @@ -namespace BouncyHsm.Pkcs11IntegrationTests; +using System.Runtime.InteropServices; + +namespace BouncyHsm.Pkcs11IntegrationTests; internal static class AssemblyTestConstants { - public const string P11LibPath = "BouncyHsm.Pkcs11Lib.dll"; + public static string P11LibPath + { + get + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + return "BouncyHsm.Pkcs11Lib.dll"; + } + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + return "BouncyHsm.Pkcs11Lib-x64.so"; + } + + throw new PlatformNotSupportedException(); + } + } public const string UserPin = "123456"; diff --git a/src/Test/BouncyHsm.Pkcs11IntegrationTests/BouncyHsm.Pkcs11IntegrationTests.csproj b/src/Test/BouncyHsm.Pkcs11IntegrationTests/BouncyHsm.Pkcs11IntegrationTests.csproj index 1bec876..50f83da 100644 --- a/src/Test/BouncyHsm.Pkcs11IntegrationTests/BouncyHsm.Pkcs11IntegrationTests.csproj +++ b/src/Test/BouncyHsm.Pkcs11IntegrationTests/BouncyHsm.Pkcs11IntegrationTests.csproj @@ -18,11 +18,18 @@ - + %(Filename)%(Extension) PreserveNewest + + + %(Filename)%(Extension) + PreserveNewest + + + diff --git a/src/Test/BouncyHsm.Pkcs11IntegrationTests/ReadMe.md b/src/Test/BouncyHsm.Pkcs11IntegrationTests/ReadMe.md index 643565d..227de50 100644 --- a/src/Test/BouncyHsm.Pkcs11IntegrationTests/ReadMe.md +++ b/src/Test/BouncyHsm.Pkcs11IntegrationTests/ReadMe.md @@ -1,6 +1,10 @@ ## How to run unit test -1. Create empty slot if not exists with following parameters: +1. Build native library + 1.1 On WIndows using Vusial Studio + 1.2 On Debian/Ubuntu use makefile +2. Run Bouncy Hsm on localhost. +3. Create empty slot if not exists with following parameters: ```json { @@ -19,5 +23,8 @@ } ``` -2. Run Bouncy Hsm on localhost. -3. Run tests. \ No newline at end of file +3. Run tests using: +``` + dotnet clean + dotnet test +```