Ejemplo n.º 1
0
        public void testBadRequestsDoNotAffectErrorPercentage()
        {
            var            properties = CommandPropertiesTest.GetUnitTestPropertiesSetter();
            var            clock      = new MockedClock();
            CommandMetrics metrics    = getMetrics(properties, clock);;

            metrics.MarkSuccess(100);
            Assert.Equal(0, metrics.GetHealthCounts().ErrorPercentage);

            metrics.MarkFailure(1000);
            Assert.Equal(50, metrics.GetHealthCounts().ErrorPercentage);

            metrics.MarkBadRequest(1);
            metrics.MarkBadRequest(2);
            Assert.Equal(50, metrics.GetHealthCounts().ErrorPercentage);

            metrics.MarkFailure(45);
            metrics.MarkFailure(55);
            Assert.Equal(75, metrics.GetHealthCounts().ErrorPercentage);
        }