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 = "hello@sayhi.com";
MockCR.FullName = "Mister T";
I get the following error: '...ClaimsResponse(string)' is inaccessible due to its protection level.
Kind regards,
Pickels
Wrong answer - correct answer in comments
You have to create it through a ClaimsRequest
object:
ClaimsRequest request = new ClaimsRequest();
ClaimsResponse response = request.CreateResponse();
精彩评论