public static void GetBigIntegerWithMinAndMaxValuesWithMaxLessThanOne() { using var random = new SecureRandom(); Assert.That(() => random.GetBigIntegerWithRange(4, 0), Throws.TypeOf <ArgumentException>() .And.Message.Contains("Max value, 0, must be greater than zero. (Parameter 'max')")); }
public static void GetBigIntegerWithMinAndMaxValuesWithMinGreaterThanMax() { using var random = new SecureRandom(); Assert.That(() => random.GetBigIntegerWithRange(4, 3), Throws.TypeOf <ArgumentException>() .And.Message.Contains("Min value, 4, must be less than the max value, 3. (Parameter 'min')")); }
public static void GetBigIntegerWithRangeWithNegativeValue() { using var random = new SecureRandom(); Assert.That(() => random.GetBigIntegerWithRange(-3), Throws.TypeOf <ArgumentException>() .And.Message.EqualTo("Max value, -3, must be greater than zero. (Parameter 'max')")); }
public static void GetBigIntegerWithRangeAfterDisposing() { SecureRandom random; using (random = new SecureRandom()) { } Assert.That(() => random.GetBigIntegerWithRange(3), Throws.TypeOf <ObjectDisposedException>()); }
public static void GetBigIntegerWithRange() { using var random = new SecureRandom(); var max = BigInteger.Parse("431531631631431"); var value = random.GetBigIntegerWithRange(max); Assert.That(value, Is.LessThan(max)); }
public static void GetBigIntegerWithMinAndMaxValues() { var min = new BigInteger(4500); var max = new BigInteger(5000); using var random = new SecureRandom(); var value = random.GetBigIntegerWithRange(min, max); Assert.That(value >= min && value < max, Is.True); }