This is, of course, quite a bit simplified. In any non-trivial venture there will be a significant number of things that need to be done and that you don't particularly enjoy doing. But if the greater part is fun then it is easier to sometimes buckle down and get through the mundane parts.
I guess it also largely depends on the personality. I, for example, hate having to do something quickly, without fully understanding the area, and moving on. On the other hand, if I have a chance to spend time and get exhaustive knowledge about something then I genuinely enjoy working on it even if on the outset it seemed unattractive (think sales, marketing, writing, etc., vs hacking some interesting piece of software).
Using a TODO lists when you already know roughly what you have to do can help enormously. The mundane act of ticking off a box next to a small task is enough motivation to get started on the next task.
Especially in the morning it can be tempting to "catch up" with all the HN posts, but if you go through your TODO list and see that you have to "fix link on page X" it's really easy to just do it. Only takes a minute. You know what you have to do, and it doesn't "feel" like work. And when you've started the next task automatically follows.
You can even put off simple tasks so you can do them whenever you're not feeling motivated, just to help you get started.
writing a unit test is a small task completion, as is passing it in a non-brain-dead manner.
http://www.amazon.com/Mastery-Keys-Success-Long-Term-Fulfill...