本文整理汇总了C#中UserService.AddUser方法的典型用法代码示例。如果您正苦于以下问题:C# UserService.AddUser方法的具体用法?C# UserService.AddUser怎么用?C# UserService.AddUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserService
的用法示例。
在下文中一共展示了UserService.AddUser方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UserService_AddUser_SavesAUserToSession
public void UserService_AddUser_SavesAUserToSession()
{
_session = A.Fake<ISession>();
_userService = new UserService(_session, _siteSettings);
var user = new User();
_userService.AddUser(user);
A.CallTo(() => _session.Save(user)).MustHaveHappened();
}
示例2: AddUserInfo
/// <summary>
/// 添加用户基本信息和收件地址
/// </summary>
/// <param name="user">
/// 用户对象
/// </param>
public void AddUserInfo(User user)
{
if (user != null)
{
var userService = new UserService();
var userReceiceAddressService = new UserReceiveAddressService();
SqlTransaction sqlTransact = null;
try
{
var userId = userService.AddUser(user, out sqlTransact);
var userReceiveAddress = new User_RecieveAddress
{
UserID = userId,
CountyID = user.CountyID,
Address = user.Address,
Consignee = user.Name,
Mobile = user.Mobile,
Tel = user.Tel,
IsDefault = true,
CreateTime = DateTime.Now
};
userReceiceAddressService.Add(userReceiveAddress, sqlTransact);
sqlTransact.Commit();
user.ID = userId;
}
catch
{
if (sqlTransact != null)
{
sqlTransact.Rollback();
}
throw;
}
}
}
示例3: WhenValidatingUserWithUnformattedPhoneNumberWithHyphensValidUserIsFound
public void WhenValidatingUserWithUnformattedPhoneNumberWithHyphensValidUserIsFound()
{
_userService = new UserService(_ctx);
var mobileNumber = "804-387-9693";
var emailAddress = "[email protected]";
var user = _userService.AddUser(Guid.NewGuid(), emailAddress, "james123", emailAddress, "");
user.MobileNumber = mobileNumber;
_userService.UpdateUser(user);
Domain.User foundUser;
_userService.ValidateUser("8043879693", "james123", out foundUser);
Assert.AreEqual(user, foundUser);
}
示例4: WhenUserRegistersUserIsAddedToUser
public void WhenUserRegistersUserIsAddedToUser()
{
_userService = new UserService(_ctx);
var username = "[email protected]";
var password = "james123";
var user = _userService.AddUser(Guid.NewGuid(), username, password, username, "1234");
Assert.AreEqual(_ctx.Users.ElementAt(0), user);
Assert.AreEqual(_ctx.Users.ElementAt(0).UserName, username);
Assert.AreEqual(_ctx.Users.ElementAt(0).EmailAddress, username);
}
示例5: WhenFindingUserByUnFormattedMobilieNumberUserWithMobileNumberIsFound
public void WhenFindingUserByUnFormattedMobilieNumberUserWithMobileNumberIsFound()
{
_userService = new UserService(_ctx);
var mobileNumber = "8043879693";
var emailAddress = "[email protected]";
var user = _userService.AddUser(Guid.NewGuid(), emailAddress, "james123", emailAddress, "");
user.MobileNumber = mobileNumber;
_userService.UpdateUser(user);
var foundUser = _userService.FindUserByMobileNumber(mobileNumber);
Assert.AreEqual(user, foundUser);
}
示例6: WhenFindingUserByIdUserWithIdIsFound
public void WhenFindingUserByIdUserWithIdIsFound()
{
_userService = new UserService(_ctx);
var mobileNumber = "8043879693";
var emailAddress = "[email protected]";
var user = _userService.AddUser(Guid.NewGuid(), emailAddress, "james123", emailAddress, "");
user.MobileNumber = mobileNumber;
_userService.UpdateUser(user);
var foundUser = _userService.GetUserById(user.UserId.ToString());
Assert.AreEqual(user, foundUser);
}
示例7: WhenFindingUserByEmailAddressUserWithEmailAddressIsFound
public void WhenFindingUserByEmailAddressUserWithEmailAddressIsFound()
{
_userService = new UserService(_ctx);
var emailAddress = "[email protected]";
var user = _userService.AddUser(Guid.NewGuid(), emailAddress, "james123", emailAddress, "");
var foundUser = _userService.FindUserByEmailAddress(emailAddress);
Assert.AreEqual(user, foundUser);
}