using Grpc.Core; using Microsoft.Extensions.Logging.Abstractions; using NSubstitute; using ZB.MOM.WW.ScadaBridge.Communication.Grpc; namespace ZB.MOM.WW.ScadaBridge.Communication.Tests; public class SiteStreamIngestAuditEventsTests { /// Verifies that the retired ingest method rejects both empty and non-empty batches. /// Whether the submitted batch contains events. /// A task that represents the asynchronous operation. [Theory] [InlineData(false)] [InlineData(true)] public async Task RetiredMethodRejectsEmptyAndNonEmptyBatches(bool nonEmpty) { var server = new SiteStreamGrpcServer(Substitute.For(), NullLogger.Instance); var request = new AuditEventBatch(); if (nonEmpty) request.Events.Add(new AuditEventDto()); var error = await Assert.ThrowsAsync(() => server.IngestAuditEvents( request, Substitute.For())); Assert.Equal(StatusCode.Unimplemented, error.StatusCode); Assert.Contains("CentralControlService", error.Status.Detail); } }