protected void Page_Load(object sender, EventArgs e)
        {
            if (sender != null && sender.GetType().Equals(this.GetType()))
            {
                if (((TestDeleteEndpoints)sender).CurrentTest != null)
                {
                    epTest = ((TestDeleteEndpoints)sender).CurrentTest;
                    beforeList = ((TestDeleteEndpoints)sender).beforeTestList;
                    afterList = ((TestDeleteEndpoints)sender).afterTestList;
                }
                else
                {
                    epTest = new TestDeleteEndpoint();
                    beforeList = new List<Endpoint>();
                    afterList = new List<Endpoint>();

                }
            }
            else
            {
                epTest = new TestDeleteEndpoint();
                beforeList = new List<Endpoint>();
                afterList = new List<Endpoint>();
            }
        }
        protected void btnTest1_Click(object sender, EventArgs e)
        {
            lstbxEndpoints.Items.Clear();
            epTest = new TestDeleteEndpoint();
            try
            {
                lblCreateEPPassFail.Visible = epTest.Set_Up_Delete_Endpoints_Test(LoginSession.adminURL, LoginSession.userToken.token_id, "tstEPTen121314", "tstEPService121314");
                lblCreateEPPassFail.Text = "PASS";

                epTest.em = Endpoint.List_Endpoints(LoginSession.adminURL, LoginSession.userToken.token_id, LoginSession.userToken.token_id);

                foreach (Endpoint endp in epTest.em)
                {
                    beforeList.Add(endp);
                }
                foreach (Endpoint endp in beforeList)
                {
                    lstbxEndpoints.Items.Add(endp.name + " " + endp.region + " " + endp.id);

                }
                //End Set Up
            }
            catch (Exception x)
            {
                lblEndpoint.Text = x.Message;
                lblCreateEPPassFail.Visible = true;
                lblCreateEPPassFail.Text = "FAIL";
            }

            Boolean ret = true;
            String output = String.Empty;

            lstbxAfter.Items.Clear();
            try
            {
                lblTearDown1.Visible = epTest.Tear_Down_Delete_Endpoints_Test(LoginSession.adminURL, LoginSession.userToken.token_id, epTest.endpoint_testUser, epTest.endpoint_testServiceid, epTest.endpoint_testTenantid);
                lblTearDown1.Text = "PASS";
                epTest.em = Endpoint.List_Endpoints(LoginSession.adminURL, LoginSession.userToken.token_id, LoginSession.userToken.token_id);

                foreach (Endpoint endp in epTest.em)
                {
                    afterList.Add(endp);
                }
                foreach (Endpoint endp in afterList)
                {

                    lstbxAfter.Items.Add(endp.name + " " + endp.region + " " + endp.id);

                }

                //End Run Test

            }
            catch (Exception x)
            {
                lblEndpoint.Text = x.Message;
                lblCreateEPPassFail.Visible = true;
                lblCreateEPPassFail.Text = "FAIL";
                pnlEndpointInfo.Visible = true;
            }
        }
        protected void btnTest4_Click(object sender, EventArgs e)
        {
            lstbxEndpoints.Items.Clear();
            epTest = new TestDeleteEndpoint();
            try
            {
                lblCreateEPPassFail.Visible = epTest.Set_Up_Delete_Endpoints_Test(LoginSession.adminURL, LoginSession.userToken.token_id, "tstEPTen121314", "tstEPService121314");
                lblCreateEPPassFail.Text = "PASS";

                epTest.em = Endpoint.List_Endpoints(LoginSession.adminURL, LoginSession.userToken.token_id, LoginSession.userToken.token_id);
                //End Set Up
            }
            catch (Exception x)
            {
                txtbTest4.Text = x.Message;
                lblTest4.Visible = true;
                lblTest4.Text = "FAIL";
            }

            Boolean ret = true;
            String output = String.Empty;

            lstbxAfter.Items.Clear();
            try
            {
                Endpoint fakeEP = new Endpoint();
                fakeEP.Delete_Endpoint(LoginSession.adminURL, LoginSession.userToken.token_id);

                lblTest4.Text = "FAIL";
                //End Run Test

            }
            catch (Exception x)
            {
                txtbTest4.Text = x.Message;
                lblTest4.Visible = epTest.Tear_Down_Delete_Endpoints_Test(LoginSession.adminURL, LoginSession.userToken.token_id, epTest.endpoint_testUser, epTest.endpoint_testServiceid, epTest.endpoint_testTenantid);
                lblTest4.Text = "PASS";
            }
        }