public async Task TestDefaultSenderAppendNoSend()
        {
            var sender = new GrpcSender();
            var span   = GetSpan();

            // Only appended, no sending, so this should not fail.
            var count = await sender.AppendAsync(span, CancellationToken.None);

            Assert.Equal(0, count);
        }
        public async Task TestSpanDoesntFit()
        {
            var maxPacketSize = 140; // Process has around 100 bytes, Span has around 50 bytes
            var sender        = new GrpcSender(GrpcSender.DefaultCollectorGrpcTarget, ChannelCredentials.Insecure, maxPacketSize);
            var span          = GetSpan();

            var ex = await Assert.ThrowsAsync <SenderException>(() => sender.AppendAsync(span, CancellationToken.None));

            Assert.Equal(1, ex.DroppedSpanCount);
            Assert.Contains("too large", ex.Message);
        }
        public async Task TestFlushing()
        {
            var maxPacketSize = 200; // Process has around 100 bytes, Span has around 50 bytes
            var sender        = new GrpcSender(GrpcSender.DefaultCollectorGrpcTarget, ChannelCredentials.Insecure, maxPacketSize);
            var span          = GetSpan();

            // Only appended, no sending, so this should not fail.
            // It's exceeding the max bytes, so it will be flushed on next append.
            var count = await sender.AppendAsync(span, CancellationToken.None);

            Assert.Equal(0, count);

            // As we don't have a gRPC endpoint running, this will fail after timeout.
            // Both spans will be lost (both appends).
            var ex = await Assert.ThrowsAsync <SenderException>(() => sender.AppendAsync(span, CancellationToken.None));

            Assert.Equal(2, ex.DroppedSpanCount);

            // Check that we really only failed because of the timeout.
            var rpcEx = Assert.IsType <RpcException>(ex.InnerException?.InnerException);

            Assert.Equal(StatusCode.Unavailable, rpcEx.StatusCode);
        }