コード例 #1
0
        public void Test__SystemRng__NextDoubleMinMaxValue03__ExpectException()
        {
            const double minValue = 2.22;
            const double maxValue = -3.34;

            IPsuedoRandomNumberGenerator generator = Factory.SystemRngPump.NewInstance();

            Assert.Throws <ArgumentOutOfRangeException>(() => generator.NextDouble(minValue, maxValue));
        }
コード例 #2
0
        public void Test__SystemRng__NextDoubleMinMaxValue06__ExpectAreEqual()
        {
            const double inputValue = double.MaxValue;

            IPsuedoRandomNumberGenerator generator = Factory.SystemRngPump.NewInstance();
            var actual = generator.NextDouble(inputValue, inputValue);

            Assert.IsNotNull(actual);
            Assert.AreEqual(actual, inputValue);
        }
コード例 #3
0
        public void Test__SystemRng__NextDoubleMaxValue06__ExpectLessThan()
        {
            const double maxValue = double.MaxValue;

            IPsuedoRandomNumberGenerator generator = Factory.SystemRngPump.NewInstance();
            var actual = generator.NextDouble(maxValue);

            Assert.IsNotNull(actual);
            Assert.IsTrue(actual < maxValue);
        }
コード例 #4
0
        public void Test__SystemRng__NextDoubleMaxValue__ExpectAreEqual()
        {
            const double maxValue = 0.00;

            IPsuedoRandomNumberGenerator generator = Factory.SystemRngPump.NewInstance();
            var actual = generator.NextDouble(maxValue);

            Assert.IsNotNull(actual);
            Assert.AreEqual(actual, maxValue);
        }
コード例 #5
0
        public void Test__SystemRng__NextDoubleMinMaxValue07__ExpectRange()
        {
            const double minValue = 0.99;
            const double maxValue = 1.11;

            IPsuedoRandomNumberGenerator generator = Factory.SystemRngPump.NewInstance();
            var actual = generator.NextDouble(minValue, maxValue);

            Assert.IsNotNull(actual);
            Assert.IsTrue(actual < maxValue);
            Assert.IsTrue(actual >= minValue);
        }
コード例 #6
0
        public void Test__SystemRng__NextDouble__ExpectSomeIntegerValues()
        {
            const int numGenerations = 1000000; // test one meellion iterations

            IPsuedoRandomNumberGenerator generator = Factory.SystemRngPump.NewInstance();

            for (var i = 0; i < numGenerations; i++)
            {
                var actual = generator.NextDouble();

                Assert.IsNotNull(actual);
                Assert.IsTrue(actual >= 0.00);
                Assert.IsTrue(actual < 1.00);
            }
        }
コード例 #7
0
        public void Test__SystemRng__NextDoubleMaxValue02__ExpectException()
        {
            IPsuedoRandomNumberGenerator generator = Factory.SystemRngPump.NewInstance();

            Assert.Throws <ArgumentOutOfRangeException>(() => generator.NextDouble(double.MinValue));
        }