views:

90

answers:

3

why to use asp.net mvc with TDD?

A: 

They are a natural combination :)

ASP.NET WebForms is not friendly to TDD. MVC makes it much easier.

Lex Li
+1  A: 

Testablity and TDD

Compared to ASP.NET testing (unit testing) is much, much easier.

Plus on a side note, I enjoy having full control over the HTML output to the users browser. Rather than the mess that ASP.NET auto generates for you.

ASP.NET MVC is a joy to use in comparison.

Finglas
+2  A: 

ASP.NET MVC offers an alternative to traditional WebForms development. It gives a clear separation of concerns in the application which makes code easier to test. In contrast to WebForms, in ASP.NET MVC infrastructure classes such as HttpContext are abstracted and could be mocked in unit tests to simulate request handling. You also have much more control over the generated HTML which is a good thing in case you want to comply with standards.

Due to the separation TDD could be applied. In this iterative process, unit tests are written to validate the code against a list of specifications. In the first stages of development writing unit tests might seem to slow down the process but as the code grows its benefits become clearer as you no longer need manually test every aspect of the application once you modify or refactor something.

Darin Dimitrov