Pickels
Pickels

Reputation: 34660

DotNetOpenAuth: Mock ClaimsResponse

I was wondering how I can mock the ClaimseReponse class in DotNetOpenAuth?

This is the class(remove a few properties):

[Serializable]
public sealed class ClaimsResponse : ExtensionBase, 
                                     IClientScriptExtensionResponse,
                                     IExtensionMessage, 
                                     IMessageWithEvents, 
                                     IMessage
{
    public static bool operator !=(ClaimsResponse one, ClaimsResponse other);
    public static bool operator ==(ClaimsResponse one, ClaimsResponse other);

    [MessagePart("email")]
    public string Email { get; set; }
    [MessagePart("fullname")]
    public string FullName { get; set; }

    public override bool Equals(object obj);
    public override int GetHashCode();
}

This is what I tried:

ClaimsResponse MockCR = new ClaimsResponse();
MockCR.Email = "[email protected]";
MockCR.FullName = "Mister T";

I get the following error: '...ClaimsResponse(string)' is inaccessible due to its protection level.

Kind regards,

Pickels

Upvotes: 2

Views: 276

Answers (1)

Andrew Arnott
Andrew Arnott

Reputation: 81801

Wrong answer - correct answer in comments

You have to create it through a ClaimsRequest object:

ClaimsRequest request = new ClaimsRequest();
ClaimsResponse response = request.CreateResponse();

Upvotes: 1

Related Questions