For every other value, such as int or a reference type, the uniquely generated placeholder value is used to look up a constraint definition. This works, because for reference types each placeholder value is truly unique and integers have enough variability that collisions from random number generation can be reasonably minimized.
For value types like bool and byte, however, this is not the case. In the case of bool, we only have two values available to us, true or false, so collisions are inevitable.
How can we get around this and allow bool values (and other low variability value types) to take advantage of ShouldBe constraints?
For every other value, such as int or a reference type, the uniquely generated placeholder value is used to look up a constraint definition. This works, because for reference types each placeholder value is truly unique and integers have enough variability that collisions from random number generation can be reasonably minimized.
For value types like
boolandbyte, however, this is not the case. In the case ofbool, we only have two values available to us,trueorfalse, so collisions are inevitable.How can we get around this and allow
boolvalues (and other low variability value types) to take advantage of ShouldBe constraints?