 <p>I would advise learning about Unit Testing. Read <a href="http://msdn.microsoft.com/en-us/magazine/cc163665.aspx" rel="nofollow">this</a> article on MSDN and search on Google for how to write unit tests. They are a great way to test individual units of code and so should be ideal for your situation.</p> <p>I would also advise separating out UI-related code, such as calls to <code>MessageBox</code>, other UI elements and <code>Console</code>; from the code you wish to test. This will make it much easier to test the logic and execution of your code.</p>