当前位置:网站首页>Unit test asp Net MVC 4 Application - unit testing asp Net MVC 4 apps thoroughly

Unit test asp Net MVC 4 Application - unit testing asp Net MVC 4 apps thoroughly

2022-07-07 04:24:00 Technology feast

problem :

I realize this is a duplicate of about 20 different posts, but none of them are specific to MVC4, and none that I've seen really answer all of my questions. I realized it was about 20 Repetition of different posts , But none of them MVC4 Peculiar , All the posts I have seen have not answered all my questions .So far my first foray into the world of TDD has been frustrating to say the least. up to now , My first foray TDD The world is at least depressing .Most of what I've tried to do seems incompatible with MVC 4 or next to impossible without using poorly documented third party libraries I don't quite understand yet. Most of what I try to do seems to be related to MVC 4 Are not compatible , Or if a third-party library with incomplete records is not used , I don't quite understand .

What I want to be able to do, is write a tests that will test my Controller Actions, The Model they're passing and The View the action is sending the model to. What I hope to do is write a test to test my controller action , They pass on models and see Action is sending model .I want to test if the view exists, I want to test if the model being passed is the right type for the view, I'd like some way to test if it will process properly. I want to test whether the view exists , I want to test whether the passed model is the correct type of view , I want some ways to test whether it will handle properly .I also want to be able to test my routes. I also hope to test my route .And testing Authentication filters? And test and verify the filter ?

I want a way to unit test ASP.Net MVC that will leave very little to chance. I want a way to ASP.Net MVC Unit test , This method has little chance .

Testing the Model output of an Action seems easy enough, but testing the views has been next to impossible. test Action Of Model Output seems easy , But testing the view is almost impossible .

So here's my list of questions: So this is my list of questions :

  1. Once I test the action and get the action result, how do I test to see if the view it wants exists? Once I test the action and get the result , How can I test to see if the view it wants exists ?
  2. How do I test my routes? How do I test my route ?
  3. How can I test to be sure my views are being processed properly? How do I test to ensure that my point of view is handled correctly ?
  4. What is really "best practice" for THOROUGH unit testing of ASP.Net MVC 4? What is? ASP.Net MVC 4 Of THOROUGH Unit testing is really “ Best practices ”?
  5. How do I unit test forms authentication? How to perform unit test form authentication ?
  6. How do I unit test Action Filters? How to unit test the action filter ?

I'd prefer to use the built in Visual Studio test projects, but if I must use NUnit, I must. I prefer to use built-in Visual Studio Test project , But if I have to use NUnit, I have to do this .I just need to make sure it gets done properly. I just need to make sure it's done correctly .

Thank you in advance for your responses. Thank you in advance for your reply .

EDIT: I also couldn't get NUnit working with my MVC4 app because of some incompatibly with the version of .NET one of the assemblies was compiled in. edit : I can't let NUnit Use my MVC4 Applications , Because some software is related to .NET Version incompatible .


Solution :

Reference resources : https://stackoom.com/en/question/cgne
原网站

版权声明
本文为[Technology feast]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130800419194.html