Answer your question: No.
Do you really need to make fun of IList?
Cats are commonly used for:
- To test behavior (through expectations), not results.
- Distract difficult or heavy addictions.
- To simplify your test code, it is easy to return the desired value.
- To check only your class in tests.
You could, for example, make fun of a repository accessing a database. Usually your tests will not scoff at the list, but rather will scoff at the object with the data that you need for your test.
t
var aList = new List<int>() { 1, 2, 3, 4, 5 }; var mockService = new Mock<IMyService>(); mockService.Setup(mock => mock.GetFooList()).Returns(aList);
This can help clarify your question if you indicate why you need to mock the container.
source share