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


C# UserService.AddUser方法代码示例

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

示例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;
                }
            }
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:43,代码来源:OrderService.cs

示例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);
        }
开发者ID:SomeHero,项目名称:SocialPayments,代码行数:17,代码来源:UserServicesTest.cs

示例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);
        }
开发者ID:SomeHero,项目名称:SocialPayments,代码行数:12,代码来源:UserServicesTest.cs

示例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);
        }
开发者ID:SomeHero,项目名称:SocialPayments,代码行数:16,代码来源:UserServicesTest.cs

示例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);
        }
开发者ID:SomeHero,项目名称:SocialPayments,代码行数:16,代码来源:UserServicesTest.cs

示例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);
        }
开发者ID:SomeHero,项目名称:SocialPayments,代码行数:12,代码来源:UserServicesTest.cs


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