Relays
AutoFixture is focused on creating instances of concrete types. For this reason it doesn't have any support for non-concrete types like interfaces and abstract classes.
By default, AutoFixture is only able to work with concrete types. In some cases, interfaces and abstract classes have an implementation or a subtype that can be used as default. To handle cases like this, AutoFixture offers the class TypeRelay
.
A TypeRelay
is a customization that can be used to instruct the Fixture to relay requests of a certain type to another one.
AutoFixture uses relays to support well-known interfaces like IList<T>
. The collection interfaces are forwarded to their most common implementation.
Last updated