I'm guessing there are two unit tests for this .... ?
-
Private Function getMonthByCode(ByVal code As String) As Integer
Select Case code Case "JUL" Return 7 Case "SEP" Return 9 Case Else Return -1 End Select
End Function
-
Private Function getMonthByCode(ByVal code As String) As Integer
Select Case code Case "JUL" Return 7 Case "SEP" Return 9 Case Else Return -1 End Select
End Function
Duncan Edwards Jones wrote:
Private Function gGetMonthByCode(ByVal code As String) As Integer
Select Case code
Case "JUL"
Return 7
Case "SEP"
Return 9
Case Else
Return -1
End Select
End FunctionFixed :) I'll ignore the fact that it's VB as I like VB (not this particular piece though) :D
Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
-
Private Function getMonthByCode(ByVal code As String) As Integer
Select Case code Case "JUL" Return 7 Case "SEP" Return 9 Case Else Return -1 End Select
End Function
Duncan Edwards Jones wrote:
I'm guessing there are two unit tests for this
No, three: don't forget to test for FILE_NOT_FOUND.
-
Private Function getMonthByCode(ByVal code As String) As Integer
Select Case code Case "JUL" Return 7 Case "SEP" Return 9 Case Else Return -1 End Select
End Function
-
Maybe the code is only in "alpha state" for now. I miss a comment like:
'TODO: implement remaining cases
:doh:
Press F1 for help or google it. Greetings from Germany
Wow. Just two? I can think of at least three more.
A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave Kreskowiak -
Wow. Just two? I can think of at least three more.
A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave KreskowiakDid you intend to reply to KarstenK or the OP?
What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???
-
Did you intend to reply to KarstenK or the OP?
What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???
Should have been the OP. Oops.
A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave Kreskowiak -
Should have been the OP. Oops.
A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave KreskowiakIt happens. One site I was on had a developer add a "feature" that caused forum replies to be attached to a random post. He said that it was supposed to "liven up the forums". I don't think he works for that site anymore. I'd post a link, but this was several years ago, and I can't remember what site it was.
What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???
-
It happens. One site I was on had a developer add a "feature" that caused forum replies to be attached to a random post. He said that it was supposed to "liven up the forums". I don't think he works for that site anymore. I'd post a link, but this was several years ago, and I can't remember what site it was.
What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???
Brisingr Aerowing wrote:
One site I was on had a developer add a "feature" that caused forum replies to be attached to a random post. He said that it was supposed to "liven up the forums". I don't think he works for that site anymore.
Uhhhh.... yeah. How was that supposed to "liven up the forms"? The only way we're ever going to know that is to find out what drugs he was on and get some.
A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave Kreskowiak -
Private Function getMonthByCode(ByVal code As String) As Integer
Select Case code Case "JUL" Return 7 Case "SEP" Return 9 Case Else Return -1 End Select
End Function
Makes sense if the only valid input is JUL or SEP