public void VeryFastRate() { // We're reporting 500MB every 750ms period var speed = 500 * 1024 * 1024; // The actual speed averaged over a 1 second period would be this var estimatedActualSpeed = speed * 4 / 3; var monitor = new SpeedMonitor(); for (int i = 0; i < 37; i++) { monitor.AddDelta(speed); monitor.Tick(750); Assert.Greater(monitor.Rate, 0, "#1." + i); Assert.Less(monitor.Rate, estimatedActualSpeed + (1 * 1024 * 1024), "#2." + i); } // Should be somewhere between 499 and 501 MB/sec Assert.IsTrue((monitor.Rate - estimatedActualSpeed) < (1 * 1024 * 1024), "#3"); }