I am trying to unittest the code under, without any success. As you can see,
_dataObjectService.ParseDataObjects(listOfObjects, dataObjects, objectMode.New);
a list (listOfObjects
) is used as an inparameter. The list is than set with values inside the method, (ParseDataObjects
).
Tried to mock the service like this:
dataObjectServiceMock.Setup(m => m.ParseDataObjects(It.IsAny<Dictionary<ObjectMode,List<ObjectItem>>>(), _listUpdateObject, objectMode.New));
private Dictionary<ObjectMode, List<ObjectItem>> Test(Object object, Foo foo)
{
var listOfObjects = new Dictionary<ObjectMode, List<ObjectItem>>();
var dataObjects = _dataReader.GetDataObjects(foo.getObjects);
var dataObjectItems = _dataReader.GetDataObjectItems(foo.getObjects);
_dataObjectService.ParseDataObjects(listOfObjects, dataObjects, objectMode.New);
_dataObjectService.ParseDataObjects(listOfObjects, dataObjectItems, objectMode.New);
return listOfObjects ;
}
When I try to mock this I can mock _dataObjectService
and the Test
method, but I have no idea how to mock that list. listOfObjects
is always empty.
How can I mock it?
Aucun commentaire:
Enregistrer un commentaire