I'm trying to unit test a function which returns a SelectList.
How can I retrieve an item from the SelectList to verify that my model is being constructed correctly?
mySelectList.Items.First().DataValue
or whatever.
Simply use mySelectList.ElementAt(n)
to get the nth SelectListItem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With