我想知道如何在DotNetOpenAuth中模拟ClaimseReponse类?
这是类(删除一些属性):
[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();
}
这就是我的尝试:
ClaimsResponse MockCR = new ClaimsResponse();
MockCR.Email = "hello@sayhi.com";
MockCR.FullName = "Mister T";
我收到以下错误:'... ClaimsResponse(string)'由于其保护级别而无法访问。
亲切的问候,
Pickels
答案 0 :(得分:1)
错误答案 - 评论中的正确答案
您必须通过ClaimsRequest
对象创建它:
ClaimsRequest request = new ClaimsRequest();
ClaimsResponse response = request.CreateResponse();