64e3fbe035
v2-ci / build (push) Failing after 1m43s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (push) Has been skipped
Adds <summary>, <param>, <typeparam>, and <inheritdoc/> tags to public members surfaced by commentchecker — resolves 5,847 of 5,869 issues (99.6%) across three /fixdocs passes.
61 lines
2.4 KiB
C#
61 lines
2.4 KiB
C#
using Opc.Ua;
|
|
using Shouldly;
|
|
using Xunit;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.Tests;
|
|
|
|
[Trait("Category", "Unit")]
|
|
public sealed class OpcUaClientSecurityPolicyTests
|
|
{
|
|
/// <summary>Verifies that every security policy enum value maps to a known non-empty URI.</summary>
|
|
/// <param name="policy">The OPC UA security policy to map.</param>
|
|
[Theory]
|
|
[InlineData(OpcUaSecurityPolicy.None)]
|
|
[InlineData(OpcUaSecurityPolicy.Basic128Rsa15)]
|
|
[InlineData(OpcUaSecurityPolicy.Basic256)]
|
|
[InlineData(OpcUaSecurityPolicy.Basic256Sha256)]
|
|
[InlineData(OpcUaSecurityPolicy.Aes128_Sha256_RsaOaep)]
|
|
[InlineData(OpcUaSecurityPolicy.Aes256_Sha256_RsaPss)]
|
|
public void MapSecurityPolicy_returns_known_non_empty_uri_for_every_enum_value(OpcUaSecurityPolicy policy)
|
|
{
|
|
var uri = OpcUaClientDriver.MapSecurityPolicy(policy);
|
|
uri.ShouldNotBeNullOrEmpty();
|
|
// Each URI should end in the enum name (for the non-None policies) so a driver
|
|
// operator reading logs can correlate the URI back to the config value.
|
|
if (policy != OpcUaSecurityPolicy.None)
|
|
uri.ShouldContain(policy.ToString());
|
|
}
|
|
|
|
/// <summary>Verifies that None security policy maps to the SDK None URI.</summary>
|
|
[Fact]
|
|
public void MapSecurityPolicy_None_matches_SDK_None_URI()
|
|
{
|
|
OpcUaClientDriver.MapSecurityPolicy(OpcUaSecurityPolicy.None)
|
|
.ShouldBe(SecurityPolicies.None);
|
|
}
|
|
|
|
/// <summary>Verifies that Basic256Sha256 policy maps to the SDK URI.</summary>
|
|
[Fact]
|
|
public void MapSecurityPolicy_Basic256Sha256_matches_SDK_URI()
|
|
{
|
|
OpcUaClientDriver.MapSecurityPolicy(OpcUaSecurityPolicy.Basic256Sha256)
|
|
.ShouldBe(SecurityPolicies.Basic256Sha256);
|
|
}
|
|
|
|
/// <summary>Verifies that Aes256_Sha256_RsaPss policy maps to the SDK URI.</summary>
|
|
[Fact]
|
|
public void MapSecurityPolicy_Aes256_Sha256_RsaPss_matches_SDK_URI()
|
|
{
|
|
OpcUaClientDriver.MapSecurityPolicy(OpcUaSecurityPolicy.Aes256_Sha256_RsaPss)
|
|
.ShouldBe(SecurityPolicies.Aes256_Sha256_RsaPss);
|
|
}
|
|
|
|
/// <summary>Verifies that every security policy enum value has a mapping.</summary>
|
|
[Fact]
|
|
public void Every_enum_value_has_a_mapping()
|
|
{
|
|
foreach (OpcUaSecurityPolicy p in Enum.GetValues<OpcUaSecurityPolicy>())
|
|
Should.NotThrow(() => OpcUaClientDriver.MapSecurityPolicy(p));
|
|
}
|
|
}
|