2 Replies - 744 Views - Last Post: 08 August 2011 - 04:29 PM Rate Topic: -----

#1 luisten   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 08-August 11

How to execute a simple class within a VS.NET project?

Posted 08 August 2011 - 03:49 PM

Hi everyone,

I currently building a medium sized web project in C# and have several classes within the App_Code folder. What I'd like to do is create a simple static void Main() in order to quickly test methods within these classes without having to deploy the entire project as it would be very time-consuming and inefficient for testing small methods.

I've created a separate Test.cs class that contains a Main() method that I'd like to execute in command line but I can't figure out how to do this quickly in VS.NET.

Any help or pointers would be greatly appreciated.

Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: How to execute a simple class within a VS.NET project?

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6259
  • View blog
  • Posts: 24,028
  • Joined: 23-August 08

Re: How to execute a simple class within a VS.NET project?

Posted 08 August 2011 - 03:59 PM

Consider looking into something like NUnit for your testing needs. I believe it even includes VS.NET integration. It did at one point, anyway.

EDIT: I lost part of my post.

Simple solution to what I believe you're looking for: create a separate project to house your driver program (test.cs). Make it the active project in your solution, add references to the libraries you wish to test. Run the program in the debugger.
Was This Post Helpful? 0
  • +
  • -

#3 Curtis Rutland   User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 5106
  • View blog
  • Posts: 9,283
  • Joined: 08-June 10

Re: How to execute a simple class within a VS.NET project?

Posted 08 August 2011 - 04:29 PM

If you're running any VS version higher than Express, you should also be able to create a Unit Test project that uses MSTEST. I don't know if NUnit is better or not, but MSTEST is integrated and should do what you want.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1