I have a lump of code that looks a bit like this:
If mode = DiaryMode.Admin Then
modeObject = DBNull.Value
ElseIf mode = DiaryMode.Academy Then
modeObject = ApplicationSettings.Academy
ElseIf mode = DiaryMode.Scouting Then
modeObject = ApplicationSettings.Scouting
Else
Throw New NotSupportedException()
End If
The idea of the check is to prep some values for passing into a database call.
There are two questions, is the Else
worth the effort? The intention is to prevent future extensions of the enum causing the code to return squify results.
If the code is valid, I'd like to be able to unit test the behaviour, if it's worth having it's worth testing. How might I go about doing that?