public void FlushesTelemetryBuffer()
            {
                var mockTelemetryBuffer = new Mock <TelemetryBuffer>();
                var channel             = new ServerTelemetryChannel {
                    TelemetryBuffer = mockTelemetryBuffer.Object
                };

                channel.Flush();

                mockTelemetryBuffer.Verify(x => x.FlushAsync());
            }
Ejemplo n.º 2
0
            public void FlushesTelemetryBuffer()
            {
                var mockTelemetryBuffer = new Mock <TelemetryChannel.Implementation.TelemetryBuffer>();
                var channel             = new ServerTelemetryChannel {
                    TelemetryBuffer = mockTelemetryBuffer.Object
                };

                channel.Initialize(TelemetryConfiguration.CreateDefault());

                channel.Flush();

                mockTelemetryBuffer.Verify(x => x.FlushAsync());
            }
            public void WaitsForAsynchronousFlushToCompleteAndAllowsItsExceptionsToBubbleUp()
            {
                var expectedException = new Exception();
                var tcs = new TaskCompletionSource <object>();

                tcs.SetException(expectedException);
                var mockTelemetryBuffer = new Mock <TelemetryBuffer>();

                mockTelemetryBuffer.Setup(x => x.FlushAsync()).Returns(tcs.Task);
                var channel = new ServerTelemetryChannel {
                    TelemetryBuffer = mockTelemetryBuffer.Object
                };

                var actualException = Assert.Throws <Exception>(() => channel.Flush());

                Assert.Same(expectedException, actualException);
            }