dimanche 4 décembre 2016

How to write tdd for existing asp.net mvc application which have all business logic in controller

I have an existing asp.net mvc application, where all the business logic was implemented inside controller. That is I fetch data from db to controller and write necessary business logic inside controller.

Now I am new in TDD, I know what is TDD but didn't yet implemented. So my question's are:

  1. How should I use TDD approach for my application, someone suggested me to separate all business logic from controller to service layer. But I have lots of method inside controller. Should I separate all of those to methods inside service layer?

  2. I read some articles there I got idea of repository pattern. Do i need to use repository pattern? or simply introduce service layer?

  3. Suppose I have an action method "AddShippingAddress" what should be the probable test case, i mean some demo testing using TDD.

  4. I need some good resource from where I can easily understand the TDD using existing mvc application as a beginner.

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire