public async Task ReceiveAsync_EmptyEnumerableIgnored() { var mockClient = new Mock <LoggingServiceV2Client>(); var consumer = new GrpcLogConsumer(mockClient.Object); await consumer.ReceiveAsync(new LogEntry[] { }, CancellationToken.None); mockClient.Verify(c => c.WriteLogEntriesAsync(null, null, LogLabels.AgentLabel, It.IsAny <IEnumerable <LogEntry> >(), CancellationToken.None), Times.Never()); }
public async Task ReceiveAsync() { var logs = new[] { new LogEntry(), new LogEntry() }; var mockClient = new Mock <LoggingServiceV2Client>(); var task = Task.FromResult(new WriteLogEntriesRequest()); mockClient.Setup(c => c.WriteLogEntriesAsync( null, null, LogLabels.AgentLabel, logs, CancellationToken.None)) .Returns(Task.FromResult(new WriteLogEntriesResponse())); var consumer = new GrpcLogConsumer(mockClient.Object); await consumer.ReceiveAsync(logs, CancellationToken.None); mockClient.VerifyAll(); }