作者:道士也调情 | 来源:互联网 | 2023-10-12 17:46
IvegotanASP.NETapplicationthatallowsuserstologon.Anotherpartofmyapplicationusesthe
I've got an ASP.NET application that allows users to log on. Another part of my application uses the UserId (the user must be logged on to access the controller). How do I fake a logon for unit testing?
我有一个允许用户登录的ASP.NET应用程序。我的应用程序的另一部分使用UserId(用户必须登录才能访问控制器)。如何伪造单元测试登录?
Here's how I get the UserId
这是我如何获得UserId
Private _UserId As Guid
Public ReadOnly Property UserId() As Guid
Get
_UserId = System.Web.Security.Membership.GetUser().ProviderUserKey
Return _UserId
End Get
End Property
Thanks
谢谢
EDIT
编辑
This is an MVC 3 project.
这是一个MVC 3项目。
5 个解决方案