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. Product Lifecycle
  3. Collaboration / Beta Testing
  4. How to test ConsoleApplications with NUnit?

How to test ConsoleApplications with NUnit?

Scheduled Pinned Locked Moved Collaboration / Beta Testing
csharpvisual-studiotestingbeta-testingtutorial
2 Posts 2 Posters 2 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.
  • E Offline
    E Offline
    Erik Doernenburg
    wrote on last edited by
    #1

    In order to write tests you need to access the classes you want to test. Of course. So, if you have a VS.NET solution that contains (a) the project you are developing and (b) the testing classes as a class library the latter has to reference the former. But how? VS insists that everything I reference must be a .dll but at the same time my assembly must be a .exe for it to be executable. I know that I could move most of the code from the executable into a .dll and just keep a stub in the .exe but this means that I would have to keep the dll around as well when I want to run my app. Can anybody think of a better solution?

    K 1 Reply Last reply
    0
    • E Erik Doernenburg

      In order to write tests you need to access the classes you want to test. Of course. So, if you have a VS.NET solution that contains (a) the project you are developing and (b) the testing classes as a class library the latter has to reference the former. But how? VS insists that everything I reference must be a .dll but at the same time my assembly must be a .exe for it to be executable. I know that I could move most of the code from the executable into a .dll and just keep a stub in the .exe but this means that I would have to keep the dll around as well when I want to run my app. Can anybody think of a better solution?

      K Offline
      K Offline
      Kevin Stewart
      wrote on last edited by
      #2

      Hi Erik, If you are using NUnit 2.0, you can create a project in your solution that creates a DLL to contain your unit tests. This will be separate from your main EXE module. Then, you can use either the console or GUI runner that NUnit provides to see the results of your unit tests. Hope this helps! Kevin "Semicolons in a programming language are like mother's milk."

      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