public void NextPercentageValueReturnsAlwaysTheSameNumber() { // given const int randomPercentage = 42; var mockRng = Substitute.For <IPrnGenerator>(); mockRng.NextPercentageValue().Returns(randomPercentage, 1, 2, 4, 5); var target = new FixedPrnGenerator(mockRng); for (var i = 0; i < 100; i++) { // when var obtained = target.NextPercentageValue(); // then Assert.That(obtained, Is.EqualTo(randomPercentage)); } }
public void NextPositiveLongReturnsAlwaysTheSameNumber() { // given const long randomNumber = 1234567890; var mockRng = Substitute.For <IPrnGenerator>(); mockRng.NextPositiveLong().Returns(randomNumber, 1L, 2L, 4L, 5L); var target = new FixedPrnGenerator(mockRng); for (var i = 0; i < 100; i++) { // when var obtained = target.NextPositiveLong(); // then Assert.That(obtained, Is.EqualTo(randomNumber)); } }