IMHO YesIn my opinion: yes they are, and yes you should.
- They give you confidence in the changes you make (everything else is
still working) this confidence is what you need to mold the code,
They give you confidence in the changes you make (everything else is still working). This confidence is what you need to mold the code, otherwise you might be afraid to change things.
otherwise you might be afraid to change things. - They make your code better, most simple mistakes are caught early with the unit tests,
catching bugs early and fixing them is always cheaper than fixing
They make your code better; most simple mistakes are caught early with the unit tests. Catching bugs early and fixing them is always cheaper than fixing them later, e.g., when the application is in production.
them later e.g. when the application is in production. - they serve as documentation for other developers on how your code works
They serve as documentation for other developers on how your code works and how to use it.
and how to use it.
The first problem you face is that ASP.NetNET in itself does not help you to write unit tests, actuallytests—actually it works against you. If you have any choice, start using ASP.NetNET MVC that, which was created with unit testing in mind. If you can't use ASP.NetNET MVC, you should use the MVP pattern in aspASP.netNET so at least you can unit test your logic easily.
Besides that you just need to get proficient in writing unit tests. If you practice TDD, your code is created testable intestable—in other words, nice and clean.
I would advise you to practice, and pair program. While reading :
- Agile Software Development, Principles, Patterns, and Practices [Hardcover]
- Head First design Patterns
- GOF Design pattern bible
- Roy osherove's first introduction to unit testing
- unit test patterns bible
orOr, for a first overview :