I have an AccountController whose constructor takes an object derived from my custom IOpenIdAuthentication interface. By default, this is an OpenIdAuthenticationService object that wraps an OpenIdRelyingParty. The interface looks like this:
public interface IOpenIdAuthentication {
IAuthenticationResponse Response { get; }
IAuthenticationRequest CreateRequest(string identifier);
}
I can mock IAuthenticationResponse:
_mockResponse = new Mock<IAuthenticationResponse>(MockBehavior.Loose);
_mockResponse.SetupGet(r => r.ClaimedIdentifier).Returns(identifier);
_mockResponse.SetupGet(r => r.Status)
.Returns(AuthenticationStatus.Authenticated);
// ... removed the formatting of 'friendlyId' ...
_mockResponse.SetupGet(r => r.FriendlyIdentifierForDisplay).Returns(friendlyId);
However, I'm not sure how to mock IAuthenticationRequest as it appears much more complicated. Any ideas?