The mental shift for me was realizing that TDD is about design, not testing. TDD allows you to reason critically about the API of the thing you're constructing. Write the tests first and it's often very clear what API is most convenient and appropriate. Then write your implementation.
Of course you should be writing tests after too (regression tests, integration tests, etc). TDD often produces good design, but not necessarily good testing code.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…