Beispiel #1
0
        public static BizAccount AccountRegistrationDataToAccount(BizAccountRegistrationData ard)
        {
            BizAccount account = new BizAccount
            {
                Login = ard.Login,
                Name = ard.Name,
                Email = ard.Email,
                AccountData = ard.AccountData,
            };

            return account;
        }
Beispiel #2
0
        public virtual void ValidateAccountRegistrationData(BizAccountRegistrationData ard)
        {
            if (ard == null)
            {
                throw new ArgumentNullException("urd");
            }

            bool ok =
                this.LoginLengthIsValid(ard.Login) &&
                this.LoginContentsIsValid(ard.Login) &&
                this.EmailIsValid(ard.Email);

            if (!ok)
            {
                throw new ApplicationException(); // todo2[ak]
            }
        }
Beispiel #3
0
        public void UserManager_Registers_User()
        {
            string userLogin = "******";
            string userEmail = "*****@*****.**";
            string userPassword = "******";

            BizAccountRegistrationData ard = new BizAccountRegistrationData
            {
                Login = userLogin,
                Email = userEmail,
                Password = userPassword,
            };

            IAccountManager userManager = TestHelper.CreateUserManager();

            userManager.RegisterAccount(ard);

            BizAccount user = userManager.GetAccountByLogin("AK");
            Assert.AreEqual("*****@*****.**", user.Email);
        }
Beispiel #4
0
 protected virtual BizAccount AccountRegistrationDataToAccount(BizAccountRegistrationData ard)
 {
     BizAccount account = WagenBackendHelper.AccountRegistrationDataToAccount(ard);
     return account;
 }
Beispiel #5
0
        public virtual void RegisterAccount(BizAccountRegistrationData ard)
        {
            _accountValidator.ValidateAccountRegistrationData(ard);
            _securityProvider.CheckPasswordPolicy(ard.Password);

            string passwordHashString = _securityProvider.GetPasswordHashString(ard.Password);

            BizAccount account = this.AccountRegistrationDataToAccount(ard);

            _accountRepository.AddAccount(account, passwordHashString);
        }