Exemplo n.º 1
0
        public void TestLogGcTime()
        {
            var statistics = new EndPointStatistics(_endPoint.Object);

            _endPoint.Setup(x => x.TotalGarbageCollectionTime).Returns(TimeSpan.Zero);
            statistics.Update();
            statistics.CreateReport().Should().Contain("avg. GC: 0.00%");

            _endPoint.Setup(x => x.TotalGarbageCollectionTime).Returns(TimeSpan.FromSeconds(1));
            statistics.Update();
            statistics.CreateReport().Should().Contain("avg. GC: 50.00%");

            statistics.Update();
            statistics.CreateReport().Should().Contain("avg. GC: 33.33%");
        }
Exemplo n.º 2
0
        public void TestLogNumProxiesCollected()
        {
            var statistics = new EndPointStatistics(_endPoint.Object);

            _endPoint.Setup(x => x.NumProxiesCollected).Returns(1);
            statistics.Update();
            statistics.CreateReport().Should().Contain("Proxies collected: 1.0/s");

            statistics.Update();
            statistics.CreateReport().Should().Contain("Proxies collected: 0.5/s");

            _endPoint.Setup(x => x.NumProxiesCollected).Returns(3);
            statistics.Update();
            statistics.CreateReport().Should().Contain("Proxies collected: 1.0/s");
        }
Exemplo n.º 3
0
        public void TestLogNumPendingMethodInvocations([Values(0, 42, 1000)] int numPendingMethodInvocations)
        {
            var statistics = new EndPointStatistics(_endPoint.Object);

            _endPoint.Setup(x => x.NumPendingMethodInvocations).Returns(numPendingMethodInvocations);
            statistics.Update();

            statistics.CreateReport().Should().Contain(string.Format("Pending method invocations: {0}", numPendingMethodInvocations));
        }
Exemplo n.º 4
0
        public void TestLogBytesSent()
        {
            var statistics = new EndPointStatistics(_endPoint.Object);

            _endPoint.Setup(x => x.NumBytesSent).Returns(1024);
            statistics.Update();
            statistics.CreateReport().Should().Contain("1.0 Kb/s");

            _endPoint.Setup(x => x.NumBytesSent).Returns(1400);
            statistics.Update();
            statistics.CreateReport().Should().Contain("0.7 Kb/s");

            _endPoint.Setup(x => x.NumBytesSent).Returns(42000);
            statistics.Update();
            statistics.CreateReport().Should().Contain("13.7 Kb/s");

            _endPoint.Setup(x => x.NumBytesSent).Returns(42000000);
            statistics.Update();
            statistics.CreateReport().Should().Contain("10253.9 Kb/s");
        }