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

                foreach (User u in userTest.users)
                {
                    beforeList.Add(u);
                }
                foreach (User u in beforeList)
                {
                    lstbxUsers.Items.Add(u.name);
                }

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

                //End Set Up
                try
                {
                    for (int i = 0; i < 10; i++)
                    {
                        ret |= userTest.run(LoginSession.adminURL, LoginSession.userToken.token_id, "TestUser" + i, "testPassword" + i, "testEmail" + i + "@email.com");
                    }

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

                    foreach (User u in userTest.users)
                    {
                        duringList.Add(u);
                    }
                    foreach (User u in duringList)
                    {
                        lstbxDuring.Items.Add(u.name);
                    }
                }
                catch (Exception x)
                {
                    lblUser.Text = x.Message;
                    lblRunTest1.Visible = true;
                    lblRunTest1.Text = "FAIL";
                    pnlUserInfo.Visible = true;
                }

                //End Run Test

                lstbxAfter.Items.Clear();
                try
                {
                    lblTearDown1.Visible = userTest.tearDown(LoginSession.adminURL, LoginSession.userToken.token_id);
                    lblTearDown1.Text = "PASS";

                    foreach (User u in userTest.users)
                    {
                        afterList.Add(u);
                    }
                    foreach (User u in afterList)
                    {
                        lstbxAfter.Items.Add(u.name);
                    }
                }
                catch (Exception x)
                {
                    lblUser.Text = x.Message;
                    lblTearDown1.Visible = true;
                    lblTearDown1.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 (((UsersAdd)sender).CurrentTest != null)
         {
             userTest = ((UsersAdd)sender).CurrentTest;
             beforeList = ((UsersAdd)sender).beforeTestList;
             afterList = ((UsersAdd)sender).afterTestList;
             duringList = ((UsersAdd)sender).duringTestList;
         }
         else
         {
             userTest = new TestAddUser();
             beforeList = new List<User>();
             afterList = new List<User>();
             duringList = new List<User>();
         }
     }
     else
     {
         userTest = new TestAddUser();
         beforeList = new List<User>();
         afterList = new List<User>();
         duringList = new List<User>();
     }
 }