Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. I'm guessing there are two unit tests for this .... ?

I'm guessing there are two unit tests for this .... ?

Scheduled Pinned Locked Moved The Weird and The Wonderful
question
10 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Duncan Edwards Jones
    wrote on last edited by
    #1

    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

    Sander RosselS B K R 4 Replies Last reply
    0
    • D Duncan Edwards Jones

      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

      Sander RosselS Offline
      Sander RosselS Offline
      Sander Rossel
      wrote on last edited by
      #2

      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 Function

      Fixed :) 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

      1 Reply Last reply
      0
      • D Duncan Edwards Jones

        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

        B Offline
        B Offline
        Bernhard Hiller
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • D Duncan Edwards Jones

          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

          K Offline
          K Offline
          KarstenK
          wrote on last edited by
          #4

          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

          D 1 Reply Last reply
          0
          • K KarstenK

            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

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            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

            B 1 Reply Last reply
            0
            • D 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 Kreskowiak

              B Offline
              B Offline
              Brisingr Aerowing
              wrote on last edited by
              #6

              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???

              D 1 Reply Last reply
              0
              • B Brisingr Aerowing

                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???

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                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

                B 1 Reply Last reply
                0
                • D 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 Kreskowiak

                  B Offline
                  B Offline
                  Brisingr Aerowing
                  wrote on last edited by
                  #8

                  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???

                  D 1 Reply Last reply
                  0
                  • B Brisingr Aerowing

                    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???

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #9

                    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

                    1 Reply Last reply
                    0
                    • D Duncan Edwards Jones

                      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

                      R Offline
                      R Offline
                      RugbyLeague
                      wrote on last edited by
                      #10

                      Makes sense if the only valid input is JUL or SEP

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups