问题描述
- 用moq给httpcontext赋值
-
public static VMERPUser Me
{
get
{
FormsIdentity userIdentity = HttpContext.Current.User.Identity as FormsIdentity;
if (userIdentity != null)
{
FormsAuthenticationTicket ticket = userIdentity.Ticket;
return JsonConvert.DeserializeObject(ticket.UserData);
}
return null;
}
}
让我能够通过这个方法得到值。不会报错。求moq给httpcontext赋值的例子
解决方案
HTTODKJJOLKLS
解决方案二:
httpcontext
时间: 2024-12-04 02:18:54