public void ComputeSampled_FirstHarvest([Range(1, 15, 1)] int calls, [Values(0.1f, DefaultPriority, 0.9f)] float defaultPriority) { // Arrange // Act for (var callCounter = 0; callCounter < calls; ++callCounter) { var priority = defaultPriority; var sampled = _adaptiveSampler.ComputeSampled(ref priority); // Assert if (callCounter < _adaptiveSampler.TargetSamplesPerInterval) { NrAssert.Multiple( () => Assert.That(sampled, Is.True), () => Assert.That(priority, Is.EqualTo(defaultPriority + PriorityBoost).Within(Epsilon)) ); } else { NrAssert.Multiple( () => Assert.That(sampled, Is.False), () => Assert.That(priority, Is.EqualTo(defaultPriority).Within(Epsilon)) ); } } }
public void ComputeSampled_FirstPeriod() { var trueCount = 0; for (var i = 0; i < Target; i++) { if (_adaptiveSampler.ComputeSampled()) { trueCount++; } } Assert.That(trueCount, Is.EqualTo(Target)); }