Пример #1
0
        protected void btnTest1_Click(object sender, EventArgs e)
        {
            lstbxUsers.Items.Clear();
            userRoleTest = new TestDeleteUserRole();
            try
            {
                lblCreateUserPassFail.Visible = userRoleTest.setUp(txtbAdminURL.Text, LoginSession.userToken.token_id, "tstUserTen1138", 10);
                lblCreateUserPassFail.Text = "PASS";

                lstbxUsers.Items.Clear();
                Boolean ret = true;
                String output = String.Empty;

                for (int i = 0; i < 10; ++i)
                {
                    ret |= userRoleTest.run(txtbAdminURL.Text, LoginSession.userToken.token_id);
                }

                lblRunTest1.Visible = ret;
                lblRunTest1.Text = "PASS";

                foreach (Role r in userRoleTest.disposableRoles)
                {
                    beforeList.Add(r);
                }
                foreach (Role r in beforeList)
                {
                    lstbxUsers.Items.Add(r.name + " " + r.id);
                }

                try
                {
                    lblTearDown1.Visible = userRoleTest.run(txtbAdminURL.Text, LoginSession.userToken.token_id);
                    lblTearDown1.Text = "PASS";

                    foreach (Role r in userRoleTest.disposableRoles)
                    {
                        afterList.Add(r);
                    }
                    foreach (Role r in afterList)
                    {
                        lstbxAfter.Items.Add(r.name + " " + r.id);
                    }
                }
                catch (Exception x)
                {
                    lblUser.Text = x.Message;
                    lblCreateUserPassFail.Visible = true;
                    lblCreateUserPassFail.Text = "FAIL";
                }
            }
            catch (Exception x)
            {
                lblUser.Text = x.Message;
                lblCreateUserPassFail.Visible = true;
                lblCreateUserPassFail.Text = "FAIL";
                pnlUserInfo.Visible = true;
            }
        }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (sender != null && sender.GetType().Equals(this.GetType()))
     {
         if (((UsersDeleteRole)sender).CurrentTest != null)
         {
             userRoleTest = ((UsersDeleteRole)sender).CurrentTest;
             beforeList = ((UsersDeleteRole)sender).beforeTestList;
             afterList = ((UsersDeleteRole)sender).afterTestList;
         }
         else
         {
             userRoleTest = new TestDeleteUserRole();
             beforeList = new List<Role>();
             afterList = new List<Role>();
         }
     }
     else
     {
         userRoleTest = new TestDeleteUserRole();
         beforeList = new List<Role>();
         afterList = new List<Role>();
     }
 }