public void Test__SystemRng__NextMinMaxValue02__ExpectException() { const int minValue = 2; const int maxValue = 1; IPsuedoRandomNumberGenerator generator = Factory.SystemRngPump.NewInstance(); Assert.Throws <ArgumentOutOfRangeException>(() => generator.Next(minValue, maxValue)); }
public void Test__SystemRng__NextMaxValue04__ExpectLessThan() { const int maxValue = int.MaxValue; IPsuedoRandomNumberGenerator generator = Factory.SystemRngPump.NewInstance(); var actual = generator.Next(maxValue); Assert.IsNotNull(actual); Assert.IsTrue(actual < maxValue); }
public void Test__SystemRng__NextMaxValue__ExpectAreEqual() { const int maxValue = 0; IPsuedoRandomNumberGenerator generator = Factory.SystemRngPump.NewInstance(); var actual = generator.Next(maxValue); Assert.IsNotNull(actual); Assert.AreEqual(actual, maxValue); }
public void Test__SystemRng__NextMinMaxValue05__ExpectRange() { const int minValue = -1; const int maxValue = 1; IPsuedoRandomNumberGenerator generator = Factory.SystemRngPump.NewInstance(); var actual = generator.Next(minValue, maxValue); Assert.IsNotNull(actual); Assert.IsTrue(actual < maxValue); Assert.IsTrue(actual >= minValue); }
public void Test__SystemRng__Next__ExpectSomeIntegerValues() { const int numGenerations = 1000000; // test one meellion iterations IPsuedoRandomNumberGenerator generator = Factory.SystemRngPump.NewInstance(); for (var i = 0; i < numGenerations; i++) { var actual = generator.Next(); Assert.IsNotNull(actual); Assert.IsTrue(actual >= 0); Assert.IsTrue(actual < int.MaxValue); } }
public void Test__SystemRng__NextMaxValue01__ExpectException() { IPsuedoRandomNumberGenerator generator = Factory.SystemRngPump.NewInstance(); Assert.Throws <ArgumentOutOfRangeException>(() => generator.Next(-1)); }