lundi 25 avril 2016

MSTest - Moq setup with a list parameter returns empty list

I have something like this:

WebRequestManagerMock.Setup(x => x.GetItemsAsync(It.IsAny<IEnumerable<Order>>())).Returns<IEnumerable<Order>>(orders => Task.FromResult<IEnumerabe<Item>>(m_Items.Take(orders.Count())));

m_Items is a static list I filled in the Class Initialize, and is not empty. orders is also not empty when I debug the test. When I call GetItemsAsync I get 0 items no matter how many orders there are. The mock is also static. Am I doing anything wrong?

Aucun commentaire:

Enregistrer un commentaire