# 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.

```csharp
public abstract class Animal { }

public class Dog : Animal { }

[Test]
public void Fixture_should_return_relayed_type()
{
    // ARRANGE
    var fixture = new Fixture();
    fixture.Customizations.Add(new TypeRelay(typeof(Animal), typeof(Dog)));

    // ACT
    var animal = fixture.Create<Animal>();

    // ASSERT
    Assert.That(animal, Is.InstanceOf<Dog>());
}
```

AutoFixture uses relays to support well-known interfaces like `IList<T>`. The [collection interfaces](/unit-testing-csharp/autofixture/default-configurations.md#collections) are forwarded to their most common implementation.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.insightarchitectures.com/unit-testing-csharp/autofixture/relays.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
