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 SiteStreamIngestCachedTelemetryTests { /// Verifies that the retired method rejects both empty and non-empty batches. /// Whether the batch under test contains any entries. /// 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 CachedTelemetryBatch(); if (nonEmpty) request.Packets.Add(new CachedTelemetryPacket()); var error = await Assert.ThrowsAsync(() => server.IngestCachedTelemetry( request, Substitute.For())); Assert.Equal(StatusCode.Unimplemented, error.StatusCode); Assert.Contains("CentralControlService", error.Status.Detail); } }