コード例 #1
0
        public void RangeTest()
        {
            var       random   = new StandardRandomNumberGenerator();
            const int minValue = 8;
            const int maxValue = 5;

            Assert.Throws <ArgumentOutOfRangeException>(() => random.Next(minValue, maxValue));
        } //ncrunch: no coverage
コード例 #2
0
        public void RangeTest()
        {
            var       random   = new StandardRandomNumberGenerator();
            const int minValue = 8;
            const int maxValue = 5;

            random.Next(minValue, maxValue);
        } //ncrunch: no coverage
コード例 #3
0
        public void Valid()
        {
            var       random   = new StandardRandomNumberGenerator();
            const int minValue = 1;
            const int maxValue = 99999999;

            var result = random.Next(minValue, maxValue);

            Assert.True(result >= minValue);
            Assert.True(result <= maxValue);
        }
コード例 #4
0
        public void GetZero()
        {
            var zeros = 0;
            var ones  = 0;
            var r     = new StandardRandomNumberGenerator();

            for (var i = 0; i < 1000; i++)
            {
                var next = r.Next(0, 1);
                Assert.True(next == 0 || next == 1);
                if (next == 0)
                {
                    zeros++;
                }
                if (next == 1)
                {
                    ones++;
                }
            }

            Assert.True(zeros > 0);
            Assert.True(ones > 0);
        }