public LogMessageRouter(int skipPercentage) { if (skipPercentage > 0) { _logDice = new WinLoseDice(skipPercentage); } }
public void then_100_fail_rate_always_lose() { _sut = new WinLoseDice(100); for (int i = 0; i < 100; i++) { _sut.Roll().Should().BeFalse(); } }
public void then_0_fail_rate_always_wins() { _sut = new WinLoseDice(0); for (int i = 0; i < 100; i++) { _sut.Roll().Should().BeTrue(); } }
private void RunDeviationTest(int numberOfRolls, int maxDeviation) { int failRate = 30; int failsCount = 0; _sut = new WinLoseDice(failRate); for (int i = 0; i < numberOfRolls; i++) { if (!_sut.Roll()) { failsCount++; } } var deviation = Math.Abs(failRate - failsCount * 100 / (double)numberOfRolls); deviation.Should().BeLessOrEqualTo(maxDeviation); }
public int then_fail_rate_boundary_is_set_correctly(int failRate) { var sut = new WinLoseDice(failRate); return(sut.FailThreshold); }