using ScadaLink.AuditLog.Site.Telemetry; using ScadaLink.Communication.Grpc; namespace ScadaLink.AuditLog.Tests.Site.Telemetry; /// /// Bundle E E1 tests for . The NoOp /// client is the default binding until M6 /// delivers the gRPC-backed implementation; both IngestAuditEventsAsync /// (M2) and IngestCachedTelemetryAsync (M3) must return an empty ack /// (no rows flipped to Forwarded) without throwing or partially handling the /// batch. /// 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( () => sut.IngestCachedTelemetryAsync(null!, CancellationToken.None)); } }