mardi 9 juin 2015

Test a property that's populated with the FromServicesAttribute

We have a controller property that populates using the FromServicesAttribute.

[FromServices]
public IGenericRepository<TodoItem> TodoItemRepository { get; }

We want to test using this property. How do we mock it? For instance, if we were using constructor injection, we could pass the mock implementation to the constructor. How do we do this with a property this way?

Aucun commentaire:

Enregistrer un commentaire