Ah unit testing.. every developer says it should be done, but it hardly ever happens, well, in SharePoint development.. :)
Andrew Woodward published an article about basic unit testing in SharePoint. A good starting point for a higher quality solution.
Some other interesting related articles about unit testing and SharePoint: