Extended test to check NextNumber

This commit is contained in:
Thorsten Sommer 2020-09-26 14:23:47 +02:00
parent e667d93a25
commit d2b03df45c

View File

@ -292,6 +292,22 @@ namespace FastRngTests.Double
Assert.That(masterToken.IsCancellationRequested, Is.False, "Master token was used to stop test"); Assert.That(masterToken.IsCancellationRequested, Is.False, "Master token was used to stop test");
Assert.That(wasCanceled, Is.True, "The consumer was not canceled"); Assert.That(wasCanceled, Is.True, "The consumer was not canceled");
var tokenSource2 = new CancellationTokenSource(TimeSpan.FromSeconds(3));
await rng.NextNumber(new Normal(), tokenSource2.Token);
Assert.That(tokenSource2.IsCancellationRequested, Is.True);
tokenSource2 = new CancellationTokenSource(TimeSpan.FromSeconds(3));
await rng.NextNumber(-1d, 1d, new Normal(), tokenSource2.Token);
Assert.That(tokenSource2.IsCancellationRequested, Is.True);
tokenSource2 = new CancellationTokenSource(TimeSpan.FromSeconds(3));
await rng.NextNumber(0u, 6u, new Normal(), tokenSource2.Token);
Assert.That(tokenSource2.IsCancellationRequested, Is.True);
tokenSource2 = new CancellationTokenSource(TimeSpan.FromSeconds(3));
await rng.NextNumber(0ul, 6ul, new Normal(), tokenSource2.Token);
Assert.That(tokenSource2.IsCancellationRequested, Is.True);
} }
[Test] [Test]