DotNetOpenAuth: Mock ClaimsResponse

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

This is the class (remove multiple 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 = "hello@sayhi.com";
MockCR.FullName = "Mister T";

      

I am getting the following error: "... ClaimsResponse (string)" not available due to protection level.

Yours faithfully,

Pickels

+2


source to share


1 answer


Wrong answer - correct answer in comments

You need to create it via an object ClaimsRequest

:



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

      

+1


source







All Articles