当前位置: 首页>>代码示例>>C#>>正文


C# IUserProfileService.ValidateUser方法代码示例

本文整理汇总了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);
 }
开发者ID:Sitecore,项目名称:Habitat,代码行数:9,代码来源:AccountsControllerTests.cs

示例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("/");
            }
        }
开发者ID:Sitecore,项目名称:Habitat,代码行数:23,代码来源:AccountsControllerTests.cs

示例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);
                }
        }
开发者ID:Sitecore,项目名称:Habitat,代码行数:23,代码来源:AccountsControllerTests.cs

示例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);
 }
开发者ID:Sitecore,项目名称:Habitat,代码行数:8,代码来源:AccountsControllerTests.cs


注:本文中的IUserProfileService.ValidateUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。