public void MinimumPeriodInSeconds()
        {
            var random = new Random();
            var min = random.Next(1, 99);
            var ct = new LinearTiming(min, random.Next(101, 1000));

            Assert.AreEqual(min, ct.FrequencyInSeconds.Minimum);
        }
Ejemplo n.º 2
0
 public void AttemptMaximmum()
 {
     var random = new Random();
     var max = random.Next(100, 1000);
     var time = new LinearTiming(random.Next(1, 10), max);
     var ex = time.Get((ulong)random.Next(61, 500));
     Assert.AreEqual(max, ex);
 }
Ejemplo n.º 3
0
 public void AttemptMinimum()
 {
     var random = new Random();
     var min = random.Next(1, 10);
     var time = new LinearTiming(min, random.Next(100, 1000));
     var ex = time.Get(0);
     Assert.AreEqual(min, ex);
 }
Ejemplo n.º 4
0
        public void AttemptsLarge()
        {
            var random = new Random();
            var min = random.Next(3600, 4000);
            var max = random.Next(28800, 86400);

            var time = new LinearTiming(min, max);
            for (ulong i = 1; i < 10; i++)
            {
                var calc = time.Get(i);

                var expected = min + (((max - min) * .1) * i);
                if (expected > max)
                {
                    break;// Not testing max
                }
                else
                {
                    Assert.AreEqual(expected, calc);
                }
            }
        }
Ejemplo n.º 5
0
        public void AttemptsSmall()
        {
            var random = new Random();
            var min = 1;// random.Next(1, 30);
            var max = 11;// random.Next(60, 120);

            var time = new LinearTiming(min, max);
            for (ulong i = 0; i < 10; i++)
            {
                var calc = time.Get(i);

                var expected = min + (((max - min) * .1) * i);
                if (expected > max)
                {
                    break;// Not testing max
                }
                else
                {
                    Assert.AreEqual(expected, calc);
                }
            }
        }