/// <summary> /// Test 2 - bad admin token /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { lstbxDuring.Items.Clear(); lstbxEndpoints.Items.Clear(); lstbxAfterEP.Items.Clear(); epTest = new TestCreateEndpoint(); try { lblTest2.Visible = epTest.Set_Up_Create_Endpoints_Test(LoginSession.adminURL, LoginSession.userToken.token_id, "tstEPTen121314", "tstEPService121314"); lblTest2.Text = "PASS"; Boolean ret = true; String output = String.Empty; //End Set Up try { for (int i = 0; i < 10; i++) { ret |= epTest.Run_Test_Endpoints(LoginSession.adminURL, "http://TestURL:5000", "http://TestURL:5000", "badadmindtoken11121314", "badadmindtoken11121314", epTest.endpoint_testTenantid, epTest.endpoint_testServiceid, "tstEPService121314", "TestRegion", i, "TestEndpoint123_", false, ref output); } } catch (Exception x) { lblTest2.Visible = epTest.Tear_Down_Create_Endpoints_Test(LoginSession.adminURL, LoginSession.userToken.token_id, epTest.endpoint_testUser, epTest.endpoint_testServiceid, epTest.endpoint_testTenantid); lblTest2.Text = "PASS"; txtbTest2.Text = x.Message; } //End Run Test try { lblTest2.Visible = epTest.Tear_Down_Create_Endpoints_Test(LoginSession.adminURL, LoginSession.userToken.token_id, epTest.endpoint_testUser, epTest.endpoint_testServiceid, epTest.endpoint_testTenantid); lblTest2.Text = "PASS"; } catch (Exception x) { } } catch (Exception x) { lblEndpoint.Text = x.Message; lblTest2.Visible = true; lblTest2.Text = "FAIL"; pnlEndpointInfo.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (sender != null && sender.GetType().Equals(this.GetType())) { if (((TestCreateEndpoints)sender).CurrentTest != null) { epTest = ((TestCreateEndpoints)sender).CurrentTest; beforeList = ((TestCreateEndpoints)sender).beforeTestList; afterList = ((TestCreateEndpoints)sender).afterTestList; duringList = ((TestCreateEndpoints)sender).duringTestList; } else { epTest = new TestCreateEndpoint(); beforeList = new List<Endpoint>(); afterList = new List<Endpoint>(); duringList = new List<Endpoint>(); } } else { epTest = new TestCreateEndpoint(); beforeList = new List<Endpoint>(); afterList = new List<Endpoint>(); duringList = new List<Endpoint>(); } }
protected void btnTest1_Click(object sender, EventArgs e) { lstbxEndpoints.Items.Clear(); epTest = new TestCreateEndpoint(); try { lblCreateEPPassFail.Visible = epTest.Set_Up_Create_Endpoints_Test(LoginSession.adminURL, LoginSession.userToken.token_id, "tstEPTen121314", "tstEPService121314"); lblCreateEPPassFail.Text = "PASS"; foreach (Endpoint endp in epTest.em) { beforeList.Add(endp); } foreach (Endpoint endp in beforeList) { lstbxEndpoints.Items.Add(endp.name + " " + endp.region + " " + endp.id); } lstbxDuring.Items.Clear(); Boolean ret = true; String output = String.Empty; //End Set Up try { for (int i = 0; i < 10; i++) { ret |= epTest.Run_Test_Endpoints(LoginSession.adminURL, "http://TestURL:5000", "http://TestURL:5000", LoginSession.userToken.token_id, epTest.EPTestToken.token_id, epTest.endpoint_testTenantid, epTest.endpoint_testServiceid, "tstEPService121314", "TestRegion", i, "TestEndpoint123_", false, ref output); } lblRunTest1.Visible = ret; lblRunTest1.Text = "PASS"; epTest.em= Endpoint.List_Endpoints(LoginSession.adminURL, LoginSession.userToken.token_id, LoginSession.userToken.token_id); foreach (Endpoint endp in epTest.em) { duringList.Add(endp); } foreach (Endpoint endp in duringList) { lstbxDuring.Items.Add(endp.name + " " + endp.region + " " + endp.id); } } catch (Exception x) { lblEndpoint.Text = x.Message; lblTearDown1.Visible = epTest.Tear_Down_Create_Endpoints_Test(LoginSession.adminURL, LoginSession.userToken.token_id, epTest.endpoint_testUser, epTest.endpoint_testServiceid, epTest.endpoint_testTenantid); lblCreateEPPassFail.Visible = true; lblCreateEPPassFail.Text = "FAIL"; pnlEndpointInfo.Visible = true; } //End Run Test lstbxAfterEP.Items.Clear(); try { lblTearDown1.Visible = epTest.Tear_Down_Create_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) { lstbxAfterEP.Items.Add(endp.name + " " + endp.region + " " + endp.id); } } catch (Exception x) { lblEndpoint.Text = x.Message; lblTearDown1.Visible = epTest.Tear_Down_Create_Endpoints_Test(LoginSession.adminURL, LoginSession.userToken.token_id, epTest.endpoint_testUser, epTest.endpoint_testServiceid, epTest.endpoint_testTenantid); lblCreateEPPassFail.Visible = true; lblCreateEPPassFail.Text = "FAIL"; } } catch (Exception x) { lblEndpoint.Text = x.Message; try { lblTearDown1.Visible = epTest.Tear_Down_Create_Endpoints_Test(LoginSession.adminURL, LoginSession.userToken.token_id, epTest.endpoint_testUser, epTest.endpoint_testServiceid, epTest.endpoint_testTenantid); } catch (Exception ex) { lblEndpoint.Text = ex.Message; } lblCreateEPPassFail.Visible = true; lblCreateEPPassFail.Text = "FAIL"; pnlEndpointInfo.Visible = true; } }