Usually I write the unit test first, to make sure it actually finds the bug, then fix it. (Which is probably how you mean this, but clarity is good.)
Red-to-green feels so nice!