Files
natsnet/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/CertificateStoreWindowsTests.cs

32 lines
953 B
C#

using System.Runtime.InteropServices;
using Shouldly;
using ZB.MOM.NatsNet.Server;
using ZB.MOM.NatsNet.Server.Auth.CertificateStore;
using ZB.MOM.NatsNet.Server.Internal;
namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog;
public sealed class CertificateStoreWindowsTests
{
[Fact] // T:158
public void WindowsTLS12ECDSA_ShouldSucceed()
{
var (matchBy, matchErr) = CertificateStoreService.ParseCertMatchBy("subject");
matchErr.ShouldBeNull();
matchBy.ShouldBe(MatchByType.Subject);
var (store, storeErr) = CertificateStoreService.ParseCertStore("windowscurrentuser");
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
storeErr.ShouldBeNull();
store.ShouldBe(StoreType.WindowsCurrentUser);
}
else
{
storeErr.ShouldBe(CertStoreErrors.ErrOSNotCompatCertStore);
store.ShouldBe(StoreType.Empty);
}
}
}