I am trying to exclude certain enumeration values such as Unknown
and Uninitialized
from the set of values for any enumeration type.
I can see that Enums
are generated in a round robin fashion using the EnumGenerator
from the set of all possible Enum
values for a given Enum
type.
Based on that code, my first thought is to build an ISpecimenBuilder
that checks for Type.IsEnum
and does a context.Resolve(request)
until Resolve
returns a value that is not on the excluded list.
The problem is this gives me a recursion error. After inspecting the source code I understand why - if a builder handles a request and calls another Resolve
again with the same request you will end up in an infinite loop.
But as EnumGenerator
is not extensible, and I can't figure out how to intercept the build chain I am stumped as to how to solve this.
EnumGenerator
? – Girosol