public void Can_compute_correct_average()
        {
            var context = new DiagnosticsContext(() => new AverageAggregator());

            context.PushResult(1);
            context.PushResult(5);

            context.Enabled = false;
            context.PushResult(200);

            Assert.Equal(3, context[""]);
        }
Esempio n. 2
0
        public void Can_compute_correct_average()
        {
            var context = new DiagnosticsContext(() => new AverageAggregator());

            context.PushResult(1);
            context.PushResult(5);

            context.Enabled = false;
            context.PushResult(200);

            Assert.Equal(3, context[""]);
        }
        public void Can_compute_correct_moving_average()
        {
            var context = new DiagnosticsContext(() => new MovingAverageAggregator(history: 2));

            context.PushResult(1);
            context.PushResult(5);

            Assert.Equal(3, context[""]);

            context.PushResult(5);

            Assert.Equal(5, context[""]);

            context.PushResult(1);

            Assert.Equal(3, context[""]);
        }
Esempio n. 4
0
        public void Can_compute_correct_moving_average()
        {
            var context = new DiagnosticsContext(() => new MovingAverageAggregator(history: 2));

            context.PushResult(1);
            context.PushResult(5);

            Assert.Equal(3, context[""]);

            context.PushResult(5);

            Assert.Equal(5, context[""]);

            context.PushResult(1);

            Assert.Equal(3, context[""]);
        }