Beispiel #1
0
        private static PasswordCreation CreatePassword(IDictionary session)
        {
            var passwordId = Guid.NewGuid().ToString();
            var password   = UserCommon.GeneratePassword();

            session[passwordId] = password;
            var passwordCreation = new PasswordCreation(password, passwordId);

            return(passwordCreation);
        }
Beispiel #2
0
        public void Check_required_fields()
        {
            Open("Main/Index");

            ClickLink("Региональные администраторы");
            ClickButton("Создать");
            var id          = UserCommon.GeneratePassword();
            var login       = String.Format("admin{0}", id);
            var managerName = String.Format("adminName{0}", id);

            ClickSaveAndCheckRequired(browser);
            browser.TextField(Find.ByName("administrator.UserName")).TypeText(login);
            ClickSaveAndCheckRequired(browser);
            browser.TextField(Find.ByName("administrator.ManagerName")).TypeText(managerName);
            ClickSaveAndCheckRequired(browser);
            browser.TextField(Find.ByName("administrator.PhoneSupport")).TypeText("123-1231230");
            browser.TextField(Find.ByName("administrator.Email")).TypeText("*****@*****.**");
            ClickButton("Сохранить");
            CheckRegistrationCard(browser, id, login, managerName);
        }
        private bool CreateUserInAD(Administrator administrator)
        {
            var isExist = Storage.IsLoginExists(administrator.UserName);

            if (isExist)
            {
                return(false);
            }

            var password       = UserCommon.GeneratePassword();
            var isLoginCreated = Storage.CreateAdmin(administrator.UserName, administrator.ManagerName, password);

            if (!isLoginCreated)
            {
                return(false);
            }
            Session["Password"] = password;
            Session["FIO"]      = administrator.ManagerName;
            Session["Login"]    = administrator.UserName;

            return(true);
        }
Beispiel #4
0
        public void Create_regional_admin()
        {
            Open("Main/Index");

            ClickLink("Региональные администраторы");
            ClickButton("Создать");
            var id          = UserCommon.GeneratePassword();
            var login       = String.Format("admin{0}", id);
            var managerName = String.Format("adminName{0}", id);

            browser.TextField(Find.ByName("administrator.UserName")).TypeText(login);
            browser.TextField(Find.ByName("administrator.ManagerName")).TypeText(managerName);
            browser.TextField(Find.ByName("administrator.PhoneSupport")).TypeText("123-1231230");
            browser.TextField(Find.ByName("administrator.InternalPhone")).TypeText("123");
            browser.TextField(Find.ByName("administrator.Email")).TypeText(String.Format("{0}@admin.net", id));
            browser.SelectList(Find.ByName("administrator.Department")).Select("IT");
            ClickButton("Сохранить");

            CheckRegistrationCard(browser, id, login, managerName);

            var admins = Administrator.FindAll();

            Assert.That(admins.Where(admin => admin.UserName.Equals(login)).Count(), Is.EqualTo(1));
        }