b211911f98
v2-ci / unit-tests (push) Failing after 13m22s
Akka.TestKit.Xunit2 -> Akka.TestKit.Xunit 1.5.62 (xunit.v3 TestKit; needs xunit.v3 3.2.2, set via VersionOverride on the four projects). Removes the xunit 2.9.3 pin. IAsyncLifetime returns ValueTask, SqlServerFactAttribute gains the source-info ctor, and xUnit1051 call sites pass TestContext.Current.CancellationToken. Test counts unchanged. Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
45 lines
1.6 KiB
C#
45 lines
1.6 KiB
C#
using Akka.Hosting;
|
|
using Akka.TestKit.Xunit;
|
|
using Shouldly;
|
|
using Xunit;
|
|
using ZB.MOM.WW.Audit;
|
|
using ZB.MOM.WW.OtOpcUa.AdminUI.Audit;
|
|
using ZB.MOM.WW.OtOpcUa.ControlPlane;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.AdminUI.Tests.Audit;
|
|
|
|
/// <summary>
|
|
/// Unit tests for <see cref="ActorAuditWriter" />, the AdminUI-side <see cref="IAuditWriter" />
|
|
/// adapter that forwards canonical audit events to the cluster-singleton
|
|
/// <see cref="AuditWriterActorKey" /> proxy resolved from the <see cref="ActorRegistry" />.
|
|
/// </summary>
|
|
public sealed class ActorAuditWriterTests : TestKit
|
|
{
|
|
/// <summary>WriteAsync forwards the event verbatim to the registered AuditWriter singleton.</summary>
|
|
[Fact]
|
|
public async Task WriteAsync_tells_the_registered_singleton()
|
|
{
|
|
var probe = CreateTestProbe("audit-writer");
|
|
var registry = new ActorRegistry();
|
|
registry.Register<AuditWriterActorKey>(probe.Ref);
|
|
|
|
var writer = new ActorAuditWriter(registry);
|
|
var evt = new AuditEvent
|
|
{
|
|
EventId = Guid.NewGuid(),
|
|
OccurredAtUtc = DateTimeOffset.UtcNow,
|
|
Actor = "alice",
|
|
Action = "Trust",
|
|
Category = "Certificate",
|
|
SourceNode = "AABBCC",
|
|
Outcome = AuditOutcome.Success,
|
|
DetailsJson = "{}",
|
|
};
|
|
|
|
await writer.WriteAsync(evt, TestContext.Current.CancellationToken);
|
|
|
|
var received = probe.ExpectMsg<AuditEvent>(TimeSpan.FromSeconds(3), cancellationToken: TestContext.Current.CancellationToken);
|
|
received.ShouldBe(evt);
|
|
}
|
|
}
|