Hello,
I am having a UserControl with an ItemsSource that allows only objects, that can be enumerated (implement IEnumerable) and where I can add/delete items. How can I test the latter?
Hello,
I am having a UserControl with an ItemsSource that allows only objects, that can be enumerated (implement IEnumerable) and where I can add/delete items. How can I test the latter?
Check the IsReadOnly
property (by casting to IList
or ICollection<T>
)
Check for an implementation of the ICollection-interface, instead of IEnumerable. Usually any collection class that has collection manipulation possibilities, implements this interface, or a child.
You can check that the object is of type ICollection (generic) or IList (non-generic) and that their IsReadOnly property is not set to True