Autofixture: Ranged request fails if request has same min and max

Created on 24 Oct 2017  路  2Comments  路  Source: AutoFixture/AutoFixture

Copied from twitter: https://twitter.com/robert_engdahl/status/922728353098067969

Robert: Surprising that the minimum and maximum are not allowed to be equal in RangedNumberRequest @AutoFixture

AutoFixture: Indeed. However am not sure about real case scenario. What is the value of field/property if it's expected to have the exact value only? 馃

Robert: The real scenario is the end-points of the range also being created by AutoFixture, and eventually then could have the same value.

--

Personally I'm finding it weird to have same Min and Max value for the Range (e.g. [Range(5,5)]), however technically it looks correct and we should handle that gracefully by ending up with a single value.

@moodmosaic Could you please share your opinion on that? Do you agree that we shouldn't fail if range consists of single element only?

bug good first issue

Most helpful comment

Nope, it doesn't throw. Ok, let's fix that to make AutoFixture more robust 馃槈

All 2 comments

Perhaps, we should return 5 in [Range(5, 5)], unless Range itself throws so there's not much we can do.

Nope, it doesn't throw. Ok, let's fix that to make AutoFixture more robust 馃槈

Was this page helpful?
0 / 5 - 0 ratings