Test Driven Development (TDD) is a software development technique that utilizes unit tests to build better software that is loosely coupled. TDD can be thought of as Red-Green-Refactor. First, you create a failing test (Red), then write just enough code in order for the test to pass (Green), then the code can be cleaned up (Refactor) as necessary.
If you’ve never written unit tests, it can be quite tricky. There is definitely an art to creating good unit tests. Luckily, a colleague of mine has put together a TDD starter kit to help you come up to speed. It contains sample projects that you can download and step thru, as well as many links to various topics on all things TDD.
You can find the TDD starter kit here. I highly recommend downloading and walking through the projects. Within it, you’ll also see examples of mocks and stubs as well as dependency injection and inversion of control.