public void InspectMinimumLimits() { double value = 0; IRandomGenerator randomGenerator = new RandomGeneratorStub(0.01); var sampleData = new SampleDataGenerator(5, 10, randomGenerator); for (int i = 0; i < 100; i++) { value = Math.Round(sampleData.GetNextValue(), 2); Assert.GreaterOrEqual(value, 5); } }
public void ChangingSetpointWorksRepeatably() { // this is to check for a bug that manifested when // ShiftSubsequentData() was called several times with // various values IRandomGenerator randomGenerator = new RandomGeneratorStub(0.95); var sampleData = new SampleDataGenerator(10, 20, randomGenerator); sampleData.GetNextValue(); sampleData.ShiftSubsequentData(200); sampleData.GetNextValue(); sampleData.ShiftSubsequentData(2000); // this one will just be 2000 sampleData.GetNextValue(); // this one will likely be different var result1 = sampleData.GetNextValue(); Assert.GreaterOrEqual(result1, 1995); Assert.LessOrEqual(result1, 2005); sampleData.ShiftSubsequentData(-2000); // this one will just be -2000 sampleData.GetNextValue(); // this one will likely be different var result2 = sampleData.GetNextValue(); Assert.GreaterOrEqual(result2, -2005); Assert.LessOrEqual(result2, -1995); }