asp.net mvc - How to write test case for mvc action filters? -


I have an action filter that I get from the link given below

There is something called " ExpectedAccount Authorization " For this, I have to write a test case. How can I do this? Some blogs have been created which I have read that we need to copy httcontext. How can I duplicate it? What do I need to do? Is there any link for this?

Do not use the [RequiresAuthentication] attribute from Rob's blog, that means a very old MVC The pre-release version is. Use the Inbox feature instead.

Since [authorized] attribute is written by the MVC team, you do not need to check the unit of reasoning. However, if you want, you can verify that it is applicable to your controllers or tasks, just type or MethodInfo if you are interested in, then call GetCustomAttributes () method to get the example of AuthorizeAttribute . You can observe the examples of those expectations you expect.

If you want, you can see the information about how to write your own filter. In addition, you can see, so if you finish writing a filter, you can type your own type You can use the same method to write unit tests.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -