7b0b9c7365
Solution + 23 src projects + 26 test projects renamed; folders, csproj, namespaces, and ScadaLinkDbContext/ScadaBridgeDbContext class updated. ActorSystem "scadalink" → "scadabridge", Akka seed-node URLs migrated. SQL roles/logins, LDAP domains, CLI command name, and CLI config dir (~/.scadalink → ~/.scadabridge) also renamed. Build green; 5 Host.Tests fail awaiting SQL login rename in next commit. Pre-existing StaleTagMonitor timing flakes unchanged. Rename script committed at tools/rename-to-scadabridge.sh.
59 lines
2.0 KiB
C#
59 lines
2.0 KiB
C#
using ZB.MOM.WW.ScadaBridge.AuditLog.Site.Telemetry;
|
|
using ZB.MOM.WW.ScadaBridge.Communication.Grpc;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.AuditLog.Tests.Site.Telemetry;
|
|
|
|
/// <summary>
|
|
/// Bundle E E1 tests for <see cref="NoOpSiteStreamAuditClient"/>. The NoOp
|
|
/// client is the default <see cref="ISiteStreamAuditClient"/> binding until M6
|
|
/// delivers the gRPC-backed implementation; both <c>IngestAuditEventsAsync</c>
|
|
/// (M2) and <c>IngestCachedTelemetryAsync</c> (M3) must return an empty ack
|
|
/// (no rows flipped to Forwarded) without throwing or partially handling the
|
|
/// batch.
|
|
/// </summary>
|
|
public class NoOpSiteStreamAuditClientTests
|
|
{
|
|
[Fact]
|
|
public async Task IngestCachedTelemetryAsync_EmptyBatch_ReturnsEmptyAck()
|
|
{
|
|
var sut = new NoOpSiteStreamAuditClient();
|
|
var batch = new CachedTelemetryBatch();
|
|
|
|
var ack = await sut.IngestCachedTelemetryAsync(batch, CancellationToken.None);
|
|
|
|
Assert.NotNull(ack);
|
|
Assert.Empty(ack.AcceptedEventIds);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task IngestCachedTelemetryAsync_PopulatedBatch_ReturnsEmptyAck()
|
|
{
|
|
var sut = new NoOpSiteStreamAuditClient();
|
|
var batch = new CachedTelemetryBatch();
|
|
batch.Packets.Add(new CachedTelemetryPacket
|
|
{
|
|
AuditEvent = new AuditEventDto
|
|
{
|
|
EventId = Guid.NewGuid().ToString(),
|
|
Channel = "ApiOutbound",
|
|
Kind = "CachedSubmit",
|
|
Status = "Submitted",
|
|
},
|
|
});
|
|
|
|
var ack = await sut.IngestCachedTelemetryAsync(batch, CancellationToken.None);
|
|
|
|
// No EventIds flipped — NoOp does not forward to anyone.
|
|
Assert.Empty(ack.AcceptedEventIds);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task IngestCachedTelemetryAsync_NullBatch_Throws()
|
|
{
|
|
var sut = new NoOpSiteStreamAuditClient();
|
|
|
|
await Assert.ThrowsAsync<ArgumentNullException>(
|
|
() => sut.IngestCachedTelemetryAsync(null!, CancellationToken.None));
|
|
}
|
|
}
|