Authentication programmable login c# -


I have a test for which I need to use authentication to see if a user Logged in before authenticating and authenticated.

Is it possible to set up authentication from the unit test, so that you authorize / log authentication in the main application to authorize and log in?

What I will do in this case is a method that takes an example of an IIdentity so you can be sure That "user" is logged in or not logged in. You can do public zero DoSomething (IIdentity Identity), you can use fake IIdentity to use any joke structure (like Rhino Mox). {If (identity.IsAuthenticated) ...}

Then your unit test will look like this:

  [test] Public Zero Test () {Var Spider = New Mock Repository (); IIdentity identification = joke. Dynamicmock & lt; IIdentity & gt; (); // your test argument here}  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -