Ejemplo n.º 1
0
        public void ProcessRateEvent256_65536()
        {
            var processor = new RateProcessor (256, 65536);

            Assert.IsNull (processor.EventTime);
            Assert.IsNull (processor.EventCount);
            Assert.IsNull (processor.Rate);

            processor.ProcessRateEvent(250, 65534);

            Assert.AreEqual (250, processor.EventTime);
            Assert.AreEqual (65534, processor.EventCount);
            Assert.IsNull (processor.Rate);

            processor.ProcessRateEvent(57, 2);

            Assert.AreEqual (57, processor.EventTime);
            Assert.AreEqual (2, processor.EventCount);
            Assert.AreEqual (65.02, Math.Round((double) processor.Rate, 2));
        }
Ejemplo n.º 2
0
        public void ProcessRateEventOverflow()
        {
            var processor = new RateProcessor (65536, 65536);

            Assert.IsNull (processor.EventTime);
            Assert.IsNull (processor.EventCount);
            Assert.IsNull (processor.Rate);

            processor.ProcessRateEvent(65530, 65534);

            Assert.AreEqual (65530, processor.EventTime);
            Assert.AreEqual (65534, processor.EventCount);
            Assert.IsNull (processor.Rate);

            processor.ProcessRateEvent(2831, 2);

            Assert.AreEqual (2831, processor.EventTime);
            Assert.AreEqual (2, processor.EventCount);
            Assert.AreEqual (1.44, Math.Round((double) processor.Rate, 2));
        }
Ejemplo n.º 3
0
        public void ProcessRateEvent()
        {
            var processor = new RateProcessor (65536, 65536);

            Assert.IsNull (processor.EventTime);
            Assert.IsNull (processor.EventCount);
            Assert.IsNull (processor.Rate);

            processor.ProcessRateEvent(2048, 3);

            Assert.AreEqual (2048, processor.EventTime);
            Assert.AreEqual (3, processor.EventCount);
            Assert.IsNull (processor.Rate);

            processor.ProcessRateEvent(4148, 6);

            Assert.AreEqual (4148, processor.EventTime);
            Assert.AreEqual (6, processor.EventCount);
            Assert.AreEqual (1.46, Math.Round((double) processor.Rate, 2));
        }