I want to debug a class, more specifically functions that I have in my class. I know that I can create a little app and reference my class and call the functions like that, but I was wondering if there is a general tool that I can provide a set of parameters into and get output from it...
Thanks.

How to debug a Class
AZZAT
Hi,
give TestDriven.Net a try. It's a testing plugin for VS2003/2005, allowing you to run unit tests, prepared in other tools, code coverage, etc.One thing I like about it is that you get some additional items in your code window's context menu, like "Run with... Debugger". Run this inside your method in a code window and it will run it and stop at any breakpoint you have set. Without running the whole application...
I also recommend using unit testing to test your classes' output automatically, without interactive debugging sessions.
Andrej
bszenith
DarrenSQLIS
Here are the steps to get going with NUnit:
- Install Nunit to your computer.
- Create a Library Assembly and add it to your solution.
- Working in that library, reference the Nunit Framwork and your assemblies.
- For that assembly project only change the Debug setting found in Start Action to Start External Program. Browse to the nunit-gui.exe.
- Setup a class which looks like this:
Replace the *xxx* with appropriate names that mean sense to you.
- Access your in the test method and initialize/create your class. Put in Asserts such as these which will check for null objects:
There are other asserts which are found by intellisense. Also put in Console.Writline calls to give a status as operations commence.
- Debug the your testing library and the gui will come up. It will start with a blank project. Choose Project->Add Assembly and choose test assembly you have just created. Once that is done Nunit will reflect into the assembly, finding your test class(es) and present them to you in the tree view.
- Save the project.
- Run all tests by choosing the parent nodes or an individual test method. If the an assert catches, a red bar will be shown or if an unhandled exception will cause a test to fail. Otherwise it will be green and one can look at Console.Out tab for information presented by the Console writes. In your test classes override ToString to print out status of the object. That will allow you to print out information to Nunit to debug.
I use Nunit and require anyone who gives me code to give me nunit tests. It allows me to come up to speed on someone else's code quite quickly. It also allows me to have a suite of tests which if I change something, my tests will me more apt to pick up the failure than a tester later on down the line. Well worth the extra effort in setting it up.using NUnit.Framework;
namespace *TestSet*
{
[TestFixture]
public class *TestSubTests*
{
[TestFixtureSetUp]
public void Init() // Setup any common test setups. This is called once before all tests. Do not put any tests/asserts here.
{
}
[Test]
public void *ActualTest*()
{
}
}
}
Assert.IsNotNull(myXml, "Xml not loaded");
Assert.IsNotNull(UserSettings, "User Settings Failure");