我想知道如何在 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)”由于其保护级别而无法访问。
亲切的问候,
泡菜
错误答案-评论中的正确答案
您必须通过 ClaimsRequest
对象创建它:
ClaimsRequest request = new ClaimsRequest();
ClaimsResponse response = request.CreateResponse();
我是一名优秀的程序员,十分优秀!