How do i moq this DotNetOpenAuth Response object? -


I have a method that (formally known as DotNetOpenId) response The object my method concludes to any claimed data, to see whether this user exists in our system, yadda ... and when the auth'd user returns the example.

Now .. how do i < feedback (reaction.state) {case}

 )   authentication status. Authorized: user user = null; Try // // Remove the claim information and // check that this user is valid, etc. // Any errors that throw errors in the form of user = _authenticationService.UthenticateUser (feedback) user; } Hold (authentication exception exception) {ViewData.ModelState.AddModelError ("AuthenticationError", exception); } .. other code, such as form auth, other feedback.states' etc. ..}  

The purpose of the spider: Mughal language: .NET C # 3.5 SP1
Reaction object: DotNetOpenAuth is taken from the framework

I'm not particularly familiar with Moq, but the reaction object is a type Which implements DotNetOpen.Open.OpenId.RelyingParty.IuthenticationResponse , so it's easy to create a class that implements such an interface The Ia can be and he is ready to return to the values ​​similar.

  var response = new duplicate & lt; IAuthenticationResponse & gt; (MockBehavior.Loose); reaction. SetupGate (R => R. Clemed Identifier). Returns ("http://blog.nerdbank.net/"); Feedback. Setup (R => R. Status). Return (certification status); reaction. SetupGate (R => R. Frondely IdentifierfreeDisplay) .Returns ("blog.nerdbank.net"); IAuthenticationResponse resp = response.Object; Console.WriteLine (resp.ClaimedIdentifier);  

Instead of sending the result to Console.WriteLine , clearly sending the resp object to the method you are testing Want to


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -