Controller how to Authenticate or Login from Test class


0 votes
asked Mar 7, 2016 by margheim (1,820 points)
I want to test my project using visual studio unit test but it produce error of null reference of User. Appreciate your insights on the challenges

4 Answers

0 votes
answered Apr 11, 2016 by nafIs (260 points)

Now that we have an attribute, let's test it. If not, we redirect to the login route.
In our case, we're using the ApplicationOAuthProvider class.
More details on How can you use Web API to authenticate users of your MVC application? - CodeProject
commented Apr 13, 2016 by aitken (710 points)
We can do this via a Startup class
0 votes
answered May 27, 2016 by Zl_8042 (310 points)
commented May 27, 2016 by Found (140 points)
Add an Identity folder into the Api project so we can namespace our classes
commented May 28, 2016 by Class_to (100 points)
This resolved the problem for me
0 votes
answered May 27, 2016 by Cloud_Dolen (680 points)
0 votes
answered May 27, 2016 by Kotter (190 points)
This also means we can get rid of Global

What is Geekub?

Q&A site for professional and enthusiast programmers, software developers and other technical users. With your help, we hope to work together to build a library of detailed answers to just about any question that is related to programming!







...