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. General Programming
  3. .NET (Core and Framework)
  4. Simple Visual Studio 2010 Question

Simple Visual Studio 2010 Question

Scheduled Pinned Locked Moved .NET (Core and Framework)
questioncsharpvisual-studio
13 Posts 6 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.
  • K Offline
    K Offline
    KFC197
    wrote on last edited by
    #1

    Hello There, I have a winform application in Visual Studio 2010 and within a class I have a shared function with the following code Public Shared Function simplestFunctionEver() as Integer Dim myInteger1 As Integer = 1, myInteger2 As Integer = 2 simplestFunctionEver = myInteger1 + myInteger2 End Function While debugging or otherwise, How can I test this function in Visual Studio 2010 Regards & Thanks in advance to users who reply Farooq

    F L P L 4 Replies Last reply
    0
    • K KFC197

      Hello There, I have a winform application in Visual Studio 2010 and within a class I have a shared function with the following code Public Shared Function simplestFunctionEver() as Integer Dim myInteger1 As Integer = 1, myInteger2 As Integer = 2 simplestFunctionEver = myInteger1 + myInteger2 End Function While debugging or otherwise, How can I test this function in Visual Studio 2010 Regards & Thanks in advance to users who reply Farooq

      F Offline
      F Offline
      fjdiewornncalwe
      wrote on last edited by
      #2

      Why would you want to, it doesn't do anything. Testing a method that takes in no arguments and returns nothing while also not changing or calculating anything external from the method is pointless.

      I wasn't, now I am, then I won't be anymore.

      K L 2 Replies Last reply
      0
      • F fjdiewornncalwe

        Why would you want to, it doesn't do anything. Testing a method that takes in no arguments and returns nothing while also not changing or calculating anything external from the method is pointless.

        I wasn't, now I am, then I won't be anymore.

        K Offline
        K Offline
        KFC197
        wrote on last edited by
        #3

        Thanks for replying. The objective of my question was not the function but the method on how one can do this in Visual Studio 2010. I can use the same function to do complex formatting and addition of time by converting it to text etc and then wishing to see what the result would look like is a legit question Regards

        1 Reply Last reply
        0
        • K KFC197

          Hello There, I have a winform application in Visual Studio 2010 and within a class I have a shared function with the following code Public Shared Function simplestFunctionEver() as Integer Dim myInteger1 As Integer = 1, myInteger2 As Integer = 2 simplestFunctionEver = myInteger1 + myInteger2 End Function While debugging or otherwise, How can I test this function in Visual Studio 2010 Regards & Thanks in advance to users who reply Farooq

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          You could: - single-step the code (not my favorite) - exercise the code by having it called, any way you like - execute unit tests (see NUnit) - have an external company validate your implementation against your requirement specifications - integrate it in a bigger app and observe (and maybe wonder why and how it is failing). :)

          Luc Pattyn [My Articles] Nil Volentibus Arduum

          1 Reply Last reply
          0
          • K KFC197

            Hello There, I have a winform application in Visual Studio 2010 and within a class I have a shared function with the following code Public Shared Function simplestFunctionEver() as Integer Dim myInteger1 As Integer = 1, myInteger2 As Integer = 2 simplestFunctionEver = myInteger1 + myInteger2 End Function While debugging or otherwise, How can I test this function in Visual Studio 2010 Regards & Thanks in advance to users who reply Farooq

            P Offline
            P Offline
            Pradeep Shukla 0
            wrote on last edited by
            #5

            You can use the VSTS test project of VS2010 to create and execute to verify or call this shared function via some other method.

            K 1 Reply Last reply
            0
            • K KFC197

              Hello There, I have a winform application in Visual Studio 2010 and within a class I have a shared function with the following code Public Shared Function simplestFunctionEver() as Integer Dim myInteger1 As Integer = 1, myInteger2 As Integer = 2 simplestFunctionEver = myInteger1 + myInteger2 End Function While debugging or otherwise, How can I test this function in Visual Studio 2010 Regards & Thanks in advance to users who reply Farooq

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Member 3357336 wrote:

              While debugging or otherwise, How can I test this function in Visual Studio 2010

              You can only debug one thing at a time. What does "test" mean here? You could add a watch to show it's return value during debugging :)

              Bastard Programmer from Hell :suss:

              K 1 Reply Last reply
              0
              • F fjdiewornncalwe

                Why would you want to, it doesn't do anything. Testing a method that takes in no arguments and returns nothing while also not changing or calculating anything external from the method is pointless.

                I wasn't, now I am, then I won't be anymore.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Marcus Kramer wrote:

                and returns nothing

                Assigning a value to the functions' name is an antique syntax for returning that value.

                Bastard Programmer from Hell :suss:

                1 Reply Last reply
                0
                • P Pradeep Shukla 0

                  You can use the VSTS test project of VS2010 to create and execute to verify or call this shared function via some other method.

                  K Offline
                  K Offline
                  KFC197
                  wrote on last edited by
                  #8

                  Hello There, Thanks for replying. Can you please clarify or guide me as to what VSTS Project is and how exactly can I call this type of function in there Regards & Thanks

                  P 1 Reply Last reply
                  0
                  • L Lost User

                    Member 3357336 wrote:

                    While debugging or otherwise, How can I test this function in Visual Studio 2010

                    You can only debug one thing at a time. What does "test" mean here? You could add a watch to show it's return value during debugging :)

                    Bastard Programmer from Hell :suss:

                    K Offline
                    K Offline
                    KFC197
                    wrote on last edited by
                    #9

                    Thanks for replying. "Test" simply means that I want to call this function and debug it's guts. Please note that users in this forum are taking this function literally. It's not the attributes of the function I am interested in but the way this could be debugged in VS2010. I could have a very "Generic", (shared) extremely lengthy format or compute function that I want to debug I am still not sure on how to do this so please help Regards P.s. I really don't want to call this function while executing my complete program and calling with a button or anything similar. Simply go to a screen call the function and be able to debug it

                    P 1 Reply Last reply
                    0
                    • K KFC197

                      Thanks for replying. "Test" simply means that I want to call this function and debug it's guts. Please note that users in this forum are taking this function literally. It's not the attributes of the function I am interested in but the way this could be debugged in VS2010. I could have a very "Generic", (shared) extremely lengthy format or compute function that I want to debug I am still not sure on how to do this so please help Regards P.s. I really don't want to call this function while executing my complete program and calling with a button or anything similar. Simply go to a screen call the function and be able to debug it

                      P Offline
                      P Offline
                      Pete OHanlon
                      wrote on last edited by
                      #10

                      The accepted way to test functions is to write unit tests, which you can call using test harnesses. There are whole books out there on the subject; what you really want to look at is unit testing c# and test driven development.

                      Forgive your enemies - it messes with their heads

                      My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                      K 1 Reply Last reply
                      0
                      • P Pete OHanlon

                        The accepted way to test functions is to write unit tests, which you can call using test harnesses. There are whole books out there on the subject; what you really want to look at is unit testing c# and test driven development.

                        Forgive your enemies - it messes with their heads

                        My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                        K Offline
                        K Offline
                        KFC197
                        wrote on last edited by
                        #11

                        Thanks. This is exactly what I wanted to know. I simply created a unit test and that did it for me Regards & Thanks to all who replied

                        P 1 Reply Last reply
                        0
                        • K KFC197

                          Thanks. This is exactly what I wanted to know. I simply created a unit test and that did it for me Regards & Thanks to all who replied

                          P Offline
                          P Offline
                          Pete OHanlon
                          wrote on last edited by
                          #12

                          You're welcome. Glad to be of service.:thumbsup:

                          Forgive your enemies - it messes with their heads

                          My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                          1 Reply Last reply
                          0
                          • K KFC197

                            Hello There, Thanks for replying. Can you please clarify or guide me as to what VSTS Project is and how exactly can I call this type of function in there Regards & Thanks

                            P Offline
                            P Offline
                            Pradeep Shukla 0
                            wrote on last edited by
                            #13

                            These links would help you understand it better: http://www.microsoft.com/presspass/itanalyst/docs/03-01-09VSTS2010TA001626ADT.PDF[^] http://msdn.microsoft.com/en-us/library/ms182413(v=vs.90).aspx[^]

                            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