public void GenerateReturnsNewValueTest(Type type, bool typeSupported, double min, double max)
{
if (typeSupported == false)
{
// Ignore this test
return;
}
var target = new AgeValueGenerator();
var value = target.Generate(type, "Age", null);
if (type.IsNullable()
&&
value == null)
{
// We can't run the assertions because null is a valid outcome
return;
}
var evaluateType = type;
if (type.IsNullable())
{
evaluateType = type.GenericTypeArguments[0];
}
value.Should().BeOfType(evaluateType);
var convertedValue = Convert.ToDouble(value);
convertedValue.Should().BeLessOrEqualTo(target.MaxAge);
convertedValue.Should().BeGreaterOrEqualTo(1);
}