The MSTest framework has a CollectionAssert that accepts ICollections. My method returns an IList. Apparently a list is not a collection..
Are there ways to make my IList an ICollection?
The MSTest framework has a CollectionAssert that accepts ICollections. My method returns an IList. Apparently a list is not a collection..
Are there ways to make my IList an ICollection?
You could call the ToArray() extension method on it - Array implements ICollection
Edit: Also, while
List<T>
implements ICollection,IList<T>
only implementsICollection<T>
which does not implement ICollection, so if you know the item in the test is aList<T>
, you should be able to cast it...You can send in a List
I get back Failed (third element does not match.)