Hi folks,
i have a method which takes in a DotNetOpenAuth (formally known as DotNetOpenId) Response
object. My method extracts any claimed data, checks to see if this user exists in our system, yadda yadda yadda... and when finished returns the auth'd user instance.
Now .. how can i use moq to mock up this response object, to test my authentication method ( AuthenticateUser()
)?
switch (response.Status)
{
case AuthenticationStatus.Authenticated:
User user = null;
try
{
// Extract the claimed information and
// check if this user is valid, etc.
// Any errors with be thrown as Authentication Errors.
user = _authenticationService.AuthenticateUser(response) as User;
}
catch (AuthenticationException exception)
{
ViewData.ModelState.AddModelError("AuthenticationError", exception);
}
.. other code, like forms auth, other response.status' etc. ..
}
Mocking framework: moq
Language: .NET C# 3.5 sp1
Response object: taken from the DotNetOpenAuth framework