I\'m trying to mock a class, called UserInputEntity
, which contains a property called ColumnNames
: (it does contain other properties, I\'ve just si
ColumnNames
is a property of type List
so when you are setting up you need to pass a List
in the Returns
call as an argument (or a func which return a List
)
But with this line you are trying to return just a string
input.SetupGet(x => x.ColumnNames).Returns(temp[0]);
which is causing the exception.
Change it to return whole list:
input.SetupGet(x => x.ColumnNames).Returns(temp);