本文整理汇总了C#中IUserProfileService.ValidateUser方法的典型用法代码示例。如果您正苦于以下问题:C# IUserProfileService.ValidateUser方法的具体用法?C# IUserProfileService.ValidateUser怎么用?C# IUserProfileService.ValidateUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUserProfileService
的用法示例。
在下文中一共展示了IUserProfileService.ValidateUser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _Login_LoggedIn_ShouldRedirect
public void _Login_LoggedIn_ShouldRedirect(Database db, [Content] DbItem item, User user, [Frozen] IAccountRepository repo, LoginInfo info, INotificationService service, IAccountsSettingsService accountSetting, IUserProfileService userProfileService)
{
userProfileService.ValidateUser(Arg.Any<User>()).ReturnsForAnyArgs(true);
var controller = new AccountsController(repo, service, accountSetting, userProfileService, null);
repo.Login(string.Empty, string.Empty).ReturnsForAnyArgs(x => user);
var result = controller._Login(info);
result.Should().BeOfType<JsonResult>();
((result as JsonResult).Data as LoginResult).RedirectUrl.Should().BeEquivalentTo(info.ReturnUrl);
}
示例2: Login_ValidData_ShouldRedirect
public void Login_ValidData_ShouldRedirect(Database db, [Content] DbItem item, User user, [Frozen] IAccountRepository repo, LoginInfo info, INotificationService service, [Frozen] IAccountsSettingsService accountSetting, IUserProfileService userProfileService)
{
accountSetting.GetPageLinkOrDefault(Arg.Any<Item>(), Arg.Any<ID>(), Arg.Any<Item>()).Returns("/");
userProfileService.ValidateUser(Arg.Any<User>()).ReturnsForAnyArgs(true);
var fakeSite = new FakeSiteContext(new StringDictionary
{
{"rootPath", "/sitecore/content"},
{"startItem", item.Name}
}) as SiteContext;
fakeSite.Database = db;
Language.Current = Language.Invariant;
using (new SiteContextSwitcher(fakeSite))
{
info.ReturnUrl = null;
info.Email = null;
info.Password = null;
var controller = new AccountsController(repo, service, accountSetting, userProfileService, null);
repo.Login(string.Empty, string.Empty).ReturnsForAnyArgs(x => user);
var result = controller.Login(info);
result.Should().BeOfType<RedirectResult>().Which.Url.Should().Be("/");
}
}
示例3: EditProfile_DefaultState_ShouldReturnProfileModel
public void EditProfile_DefaultState_ShouldReturnProfileModel(string profileItemId, [Substitute] EditProfile editProfile, IUserProfileService userProfileService)
{
var user = Substitute.For<User>("extranet/John", true);
user.Profile.Returns(Substitute.For<UserProfile>());
user.Profile.ProfileItemId = profileItemId;
userProfileService.GetUserDefaultProfileId().Returns(profileItemId);
userProfileService.GetProfile(Arg.Any<UserProfile>()).Returns(editProfile);
userProfileService.ValidateUser(Arg.Any<User>()).ReturnsForAnyArgs(true);
var fakeSite = new FakeSiteContext(new StringDictionary
{
{"displayMode", "normal"},
{"domain", "extranet"}
}) as SiteContext;
using (new SiteContextSwitcher(fakeSite))
using (new UserSwitcher(user))
{
var accounController = new AccountsController(null, null, null, userProfileService, null);
var result = accounController.EditProfile();
result.Should().BeOfType<ViewResult>().Which.Model.Should().Be(editProfile);
}
}
示例4: Login_ValidaData_ShouldRedirectToReturnUrl
public void Login_ValidaData_ShouldRedirectToReturnUrl([Frozen] IAccountRepository repo, LoginInfo info, User user, INotificationService service, IAccountsSettingsService accountSetting, IUserProfileService userProfileService)
{
userProfileService.ValidateUser(Arg.Any<User>()).ReturnsForAnyArgs(true);
var controller = new AccountsController(repo, service, accountSetting, userProfileService, null);
repo.Login(string.Empty, string.Empty).ReturnsForAnyArgs(x => user);
var result = controller.Login(info);
result.Should().BeOfType<RedirectResult>().Which.Url.Should().Be(info.ReturnUrl);
}