本文整理汇总了C#中IUserProfileService.GetUserDefaultProfileId方法的典型用法代码示例。如果您正苦于以下问题:C# IUserProfileService.GetUserDefaultProfileId方法的具体用法?C# IUserProfileService.GetUserDefaultProfileId怎么用?C# IUserProfileService.GetUserDefaultProfileId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUserProfileService
的用法示例。
在下文中一共展示了IUserProfileService.GetUserDefaultProfileId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EditProfilePostShouldReturnModelErrors
public void EditProfilePostShouldReturnModelErrors(FakeSiteContext siteContext, ModelStateDictionary modelState, string profileItemId, IEnumerable<string> interests, [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.GetInterests().Returns(interests);
userProfileService.ValidateProfile(Arg.Any<EditProfile>(), Arg.Do<ModelStateDictionary>(x => x.AddModelError("key", "error"))).Returns(false);
using (new SiteContextSwitcher(siteContext))
using (new UserSwitcher(user))
{
var accounController = new AccountsController(null, null, null, userProfileService);
var result = accounController.EditProfile(editProfile);
result.Should().BeOfType<ViewResult>().Which.ViewData.ModelState.Should().ContainKey("key").WhichValue.Errors.Should().Contain(e => e.ErrorMessage == "error");
}
}
示例2: EditProfilePostShouldReturnInfoMessageIfProfileDoesntMatch
public void EditProfilePostShouldReturnInfoMessageIfProfileDoesntMatch(string siteProfileId, 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(siteProfileId);
var fakeSite = new FakeSiteContext(new StringDictionary
{
{"displayMode", "normal"}
}) as SiteContext;
using (new SiteContextSwitcher(fakeSite))
using (new UserSwitcher(user))
{
var accounController = new AccountsController(null, null, null, userProfileService);
var result = accounController.EditProfile(editProfile);
result.Should().BeOfType<ViewResult>().Which.Model.Should().BeOfType<InfoMessage>().Which.Type.Should().Be(InfoMessage.MessageType.Error);
}
}
示例3: EditProfilePostShouldUpdateProfile
public void EditProfilePostShouldUpdateProfile(FakeSiteContext siteContext, 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.ValidateProfile(Arg.Any<EditProfile>(), Arg.Any<ModelStateDictionary>()).Returns(true);
using (new SiteContextSwitcher(siteContext))
using (new UserSwitcher(user))
{
var accounController = new AccountsController(null, null, null, userProfileService);
var result = accounController.EditProfile(editProfile);
userProfileService.Received(1).SetProfile(user.Profile, editProfile);
result.Should().BeOfType<ViewResult>().Which.Model.Should().BeOfType<InfoMessage>().Which.Type.Should().Be(InfoMessage.MessageType.Info);
}
}
示例4: EditProfileShouldReturnProfileModel
public void EditProfileShouldReturnProfileModel(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);
var fakeSite = new FakeSiteContext(new StringDictionary
{
{"displayMode", "normal"}
}) 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);
}
}