Definitely create unit tests and consider using
Pex[
^] to do some automated analysis and testing of your back-end code.
FitNesse[
^] can be used for acceptance testing at the user-story level.
For automated UI testing, there are tools like
Watin[
^] and
Selenium[
^] for the web and
White[
^] for WinForms (and WPF?) testing.
If you really want to write your own automated UI tests, MSDN has some information on how to use the Windows Automation API here:
Using UI Automation for Automated Testing[
^]