Ejemplo n.º 1
0
        public void TestSteps()
        {
            const int numberOfEvents = 500;
            var       generator      = new RandomTimeStepGenerator(numberOfEvents);
            var       stopwatch      = new Stopwatch();

            stopwatch.Start();
            var steps = generator.MillisecondDeltas;

            Assert.AreEqual(numberOfEvents, steps.Count);
            var sum = generator.MillisecondDeltas.Sum();

            Assert.AreEqual(1000.0, sum, 0.1);
            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 10);
        }
Ejemplo n.º 2
0
        public void TestSteps()
        {
            var random = new Random();

            for (int i = 0; i < 20000; i++)
            {
                int numberOfEvents = random.Next(1, 1000);
                var generator      = new RandomTimeStepGenerator(numberOfEvents);
                var stopwatch      = new Stopwatch();
                stopwatch.Start();
                var steps = generator.MillisecondDeltas;
                Assert.AreEqual(numberOfEvents, steps.Count);
                var sum = generator.MillisecondDeltas.Sum();
                Assert.AreEqual(1000.0, sum, 0.1);
                Assert.IsTrue(stopwatch.ElapsedMilliseconds < 10);
            }
        }