Exemplo n.º 1
0
 public static void SocketTransportCanSendOverIPWithoutError()
 {
     using (var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.IP))
     {
         transport.Send("teststat:1|c");
     }
 }
Exemplo n.º 2
0
 public static void SocketTransportIsNoopForEmptyArray()
 {
     using (var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.IP))
     {
         transport.Send(new ArraySegment <byte>(Array.Empty <byte>()));
     }
 }
Exemplo n.º 3
0
        public static void SocketTransportCanSendOverUdpWithoutError()
        {
            // using block not used here so the finalizer gets some code coverage
            var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.Udp);

            transport.Send("teststat:1|c");
        }
        public static void SocketTransportIsNoopForNullEndpoint()
        {
            var endpointSource = Mock.Of <IEndPointSource>();

            using var transport = new SocketTransport(endpointSource, SocketProtocol.IP);
            transport.Send("teststat:1|c");
        }
        public static void SocketTransportCanSendOverUdpWithoutError()
        {
            // Using block not used here so the finalizer gets some code coverage
#pragma warning disable CA2000
            var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.Udp);
#pragma warning restore CA2000

            transport.Send("teststat:1|c");
        }
        public void AMetricCanBeSentWithoutAnExceptionBeingThrown()
        {
            // Arrange
            var endPointSource = EndPointFactory.MakeEndPointSource(
                UdpListeners.EndpointA,
                null);

            using var target = new SocketTransport(endPointSource, SocketProtocol.Udp);

            // Act and Assert
            target.Send("mycustommetric");
        }
        public void MultipleMetricsCanBeSentWithoutAnExceptionBeingThrownParallel()
        {
            // Arrange
            var endPointSource = EndPointFactory.MakeEndPointSource(
                UdpListeners.EndpointA,
                null);

            using var target = new SocketTransport(endPointSource, SocketProtocol.Udp);

            Parallel.For(0, 10_000, _ =>
            {
                // Act and Assert
                target.Send("mycustommetric:1|c");
            });
        }
Exemplo n.º 8
0
        public void MultipleMetricsCanBeSentWithoutAnExceptionBeingThrownSerial()
        {
            // Arrange
            var endPointSource = EndpointParser.MakeEndPointSource(
                UdpListeners.EndpointA,
                null);

            using (var target = new SocketTransport(endPointSource, SocketProtocol.Udp))
            {
                for (int i = 0; i < 10_000; i++)
                {
                    // Act and Assert
                    target.Send("mycustommetric:1|c");
                }
            }
        }
        public static void EndpointSwitchShouldNotCauseExceptionsParallel()
        {
            // Arrange
            var endPointSource1 = EndPointFactory.MakeEndPointSource(
                UdpListeners.EndpointA,
                null);

            var endPointSource2 = EndPointFactory.MakeEndPointSource(
                UdpListeners.EndpointB,
                null);

            using var target = new SocketTransport(new MillisecondSwitcher(endPointSource2, endPointSource1), SocketProtocol.Udp);

            Parallel.For(0, 10_000, _ =>
            {
                // Act and Assert
                target.Send("mycustommetric");
            });
        }
Exemplo n.º 10
0
        public static void EndpointSwitchShouldNotCauseExceptionsSequential()
        {
            // Arrange
            var endPointSource1 = EndPointFactory.MakeEndPointSource(
                UdpListeners.EndpointA,
                null);

            var endPointSource2 = EndPointFactory.MakeEndPointSource(
                UdpListeners.EndpointB,
                null);

            using var target = new SocketTransport(new MillisecondSwitcher(endPointSource2, endPointSource1), SocketProtocol.Udp);

            for (int i = 0; i < 10_000; i++)
            {
                // Act and Assert
                target.Send("mycustommetric:1|c");
            }
        }
Exemplo n.º 11
0
 public static void SocketTransportIsNoopForNullArray()
 {
     using var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.IP);
     transport.Send(new ArraySegment <byte>());
 }
        public static void SocketTransportCanSendOverUdpWithoutError()
        {
            var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.Udp);

            transport.Send("teststat:1|c");
        }