Hi there,
I am trying out Isolator and so far loving it!
The method I would like to test looks like this:
public void MapItems(SPListItemCollection itemCollection)
{
foreach (SPListItem item in itemCollection)
{
//Do something
}
}
I have created a fake SPListItemCollection - but I can't work out how to fake the behaviour for the line
foreach (SPListItem item in itemCollection)
What I'd like is for an exception to be thrown when the statement above is executed. I found that with SPQuery, if the query is invalid (e.g. referring to a field that does not exist) then the exception is thrown not on SPList.GetItems(), but rather when the SPListItemCollection is accessed, e.g. in a foreach statemeetnt.
The other thing I need to fake is to add a couple of SPListItem to this collection.
How can these things be done?
Thanks!