public void NextInt32Test() { using var rng = new RandomNonceGenerator(); int actual1 = rng.NextInt32(); int actual2 = rng.NextInt32(); Assert.NotEqual(actual1, actual2); }
public void DisposedExceptionTest() { var rng = new RandomNonceGenerator(); rng.Dispose(); Assert.Throws <ObjectDisposedException>(() => rng.NextInt32()); Assert.Throws <ObjectDisposedException>(() => rng.NextInt32(1, 2)); Assert.Throws <ObjectDisposedException>(() => rng.NextInt64()); Assert.Throws <ObjectDisposedException>(() => rng.GetDistinct(0, 10, 2)); }
public void NextInt32_MinMaxTest() { using var rng = new RandomNonceGenerator(); int min = 1; int max = 5; int actual = rng.NextInt32(min, max); Assert.True(actual >= min); Assert.True(actual < max); }