public void GenerateCanEvalutateManyTimesTest(Type type, bool typeSupported, double min, double max)
{
if (typeSupported == false)
{
// Ignore this test
return;
}
var target = new NumericValueGenerator();
for (var index = 0; index < 10000; index++)
{
var value = target.Generate(type, null, null);
if (type.IsNullable() && value == null)
{
// Nullable values could be returned so nothing more to assert
return;
}
var evaluateType = type;
if (type.IsNullable())
{
evaluateType = type.GenericTypeArguments[0];
}
value.Should().BeOfType(evaluateType);
var convertedValue = Convert.ToDouble(value);
convertedValue.Should().BeGreaterOrEqualTo(min);
convertedValue.Should().BeLessOrEqualTo(max);
}
}