本文整理汇总了C#中IdentityUser.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IdentityUser.ToString方法的具体用法?C# IdentityUser.ToString怎么用?C# IdentityUser.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IdentityUser
的用法示例。
在下文中一共展示了IdentityUser.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Updating_user_name_to_existing_name_returns_DuplicateUserName_error
public async Task Updating_user_name_to_existing_name_returns_DuplicateUserName_error()
{
// arrange
var user1 = new IdentityUser("Updating_user_name_to_existing_name_returns_DuplicateUserName_error");
var user2 = new IdentityUser("Updating_user_name_to_existing_name_returns_DuplicateUserName_error different");
await _userStore.CreateAsync(user1);
await _userStore.CreateAsync(user2);
// act
user2.UserName = user1.UserName;
var result3 = await _userStore.UpdateAsync(user2);
// assert
var expectedError = IdentityResult.Failed(_errorDescriber.DuplicateUserName(user2.ToString()));
IdentityResultAssert.IsFailure(result3, expectedError.Errors.FirstOrDefault());
}
示例2: Creating_same_user_twice_returns_DuplicateUserName_error
public async Task Creating_same_user_twice_returns_DuplicateUserName_error()
{
// arrange
var user = new IdentityUser("Creating_same_user_twice_returns_DuplicateUserName_error");
// act
var result1 = await _userStore.CreateAsync(user);
user.UserName = "a different name, but same Id";
var result2 = await _userStore.CreateAsync(user);
// assert
IdentityResultAssert.IsSuccess(result1);
var expectedError = IdentityResult.Failed(_errorDescriber.DuplicateUserName(user.ToString()));
IdentityResultAssert.IsFailure(result2, expectedError.Errors.FirstOrDefault());
}
示例3: Creating_two_different_users_but_same_UserName_returns_DuplicateUserName_error
public async Task Creating_two_different_users_but_same_UserName_returns_DuplicateUserName_error()
{
// arrange
var user1 = new IdentityUser("Creating_two_different_users_but_same_UserName_returns_DuplicateUserName_error");
var user2 = new IdentityUser(user1.UserName);
// act
var result1 = await _userStore.CreateAsync(user1);
var result2 = await _userStore.CreateAsync(user2);
// assert
IdentityResultAssert.IsSuccess(result1);
var expectedError = IdentityResult.Failed(_errorDescriber.DuplicateUserName(user2.ToString()));
IdentityResultAssert.IsFailure(result2, expectedError.Errors.FirstOrDefault());
}