public override void EditTest() { LabelTester Nazwa = new LabelTester("ctl01_Nazwa", CurrentWebForm); LabelTester Opis = new LabelTester("ctl01_Opis", CurrentWebForm); Zalacznik z = Zalacznik.GetWellKnown(); z.Save(null); IdTb.Text = z.Id.ToString(); PostBtn.Click(); AreEqual(z.Nazwa, Nazwa.Text, "nazwa"); AreEqual(z.Opis, Opis.Text, "opis"); EditBtn.Click(); TextBoxTester NazwaEdit = new TextBoxTester("ctl01_NazwaEdit", CurrentWebForm); TextBoxTester OpisEdit = new TextBoxTester("ctl01_OpisEdit", CurrentWebForm); string unNazwa = Guid.NewGuid().ToString(); string unOpis = Guid.NewGuid().ToString(); NazwaEdit.Text = unNazwa; OpisEdit.Text = unOpis; SaveBtn.Click(); Zalacznik zalacznikFromDb = (Zalacznik)z.Resync(); AreEqual(unNazwa, zalacznikFromDb.Nazwa, "Nazwa"); AreEqual(unOpis, zalacznikFromDb.Opis, "Opis"); zalacznikFromDb.Delete(); }
public void CreateAccount() { // use the ViewAccounts page to create a new account. // This shows how to interact with the asp form, but also // that testing the ASPX page doesn't have as much value // as you might think. #region some constants const string newName = "Testing Account"; const string newBalance = "1234"; #endregion #region set up the page LoadPage("viewaccounts.aspx"); TextBoxTester txtName = new TextBoxTester("txtName", CurrentWebForm); TextBoxTester txtBalance = new TextBoxTester("txtBalance", CurrentWebForm); ButtonTester btnCreate = new ButtonTester("btnCreate", CurrentWebForm); #endregion #region fill in some data & submit form txtName.Text = newName; txtBalance.Text = newBalance; btnCreate.Click(); #endregion #region Datagrid - did it work? // the page has refreshed -- // see if our new account is in the grid. DataGridTester grdAccounts = new DataGridTester( "grdAccounts", CurrentWebForm); // the last row is the newest one: DataGridTester.Row newRow = grdAccounts.GetRow(grdAccounts.RowCount - 1); // first cell is account id, 2nd is account name // name should be the same as the value we just saved... Assert("New account wasn't last in the grid", newRow.TrimmedCells[1] == newName); #endregion #region teardown // delete the account we just created. AccountFactory.DeleteAccount(int.Parse(newRow.TrimmedCells[0])); #endregion }
public void TestCustomValidator() { CustomValidatorTester cuvValidateNum = new CustomValidatorTester("cuvValidateNum", CurrentWebForm); TextBoxTester txtNum = new TextBoxTester("txtNum", CurrentWebForm); WebAssert.NotVisible(cuvValidateNum, "should not be visible at start"); txtNum.Text = "16"; btnSubmit.Click(); AssertVisibility(cuvValidateNum, true); AssertEquals("Value must be a multiple of 5", cuvValidateNum.ErrorMessage); }
public void TestRangeValidator() { RangeValidatorTester rvAge = new RangeValidatorTester("rvAge", CurrentWebForm); TextBoxTester txtAge = new TextBoxTester("txtAge", CurrentWebForm); WebAssert.NotVisible(rvAge, "should not be visible at start"); txtAge.Text = "1"; btnSubmit.Click(); AssertVisibility(rvAge, true); AssertEquals("Age must be 18 or higher", rvAge.ErrorMessage); }
public static void SetData(Kontakt k2i, string prefix, WebForm currentWebForm) { TextBoxTester Fax = new TextBoxTester(GetCtrlId(prefix,"FaxEdit"), currentWebForm); TextBoxTester Tel = new TextBoxTester(GetCtrlId(prefix,"TelEdit"), currentWebForm); TextBoxTester Tel2 = new TextBoxTester(GetCtrlId(prefix,"Tel2Edit"), currentWebForm); TextBoxTester Email = new TextBoxTester(GetCtrlId(prefix,"EmailEdit"), currentWebForm); TextBoxTester Www = new TextBoxTester(GetCtrlId(prefix,"WwwEdit"), currentWebForm); Fax.Text = k2i.Fax; Tel.Text = k2i.Tel; Tel2.Text = k2i.Tel2; Email.Text = k2i.Email; Www.Text = k2i.Www; }
public void TestCompareValidator() { CompareValidatorTester cvPassword = new CompareValidatorTester("cvPassword", CurrentWebForm); TextBoxTester txtPassword = new TextBoxTester("txtPassword", CurrentWebForm); TextBoxTester txtPassword2 = new TextBoxTester("txtPassword2", CurrentWebForm); WebAssert.NotVisible(cvPassword, "should not be visible at start"); txtPassword.Text = "ab"; txtPassword2.Text = "abc"; btnSubmit.Click(); AssertVisibility(cvPassword, true); AssertEquals("Passwords do not match", cvPassword.ErrorMessage); }
public void TestDynamicListDefinitionForArticles() { Console.WriteLine("TestDynamicListDefinitionForArticles"); //DnaTestURLRequest dnarequest = new DnaTestURLRequest("haveyoursay"); _dnarequest.SetCurrentUserEditor(); _dnarequest.UseEditorAuthentication = true; string relativePath = @"/dna/haveyoursay/EditDynamicListDefinition"; _dnarequest.RequestNUnitASPPage(relativePath, Browser); TextBoxTester name = new TextBoxTester("txtName", CurrentWebForm); name.Text = "DynamicListForArticle"; DropDownListTester type = new DropDownListTester("cmbType", CurrentWebForm); ListItemTester item = type.Items.FindByValue("ARTICLES"); item.Selected = true; //Create Dynamic List Definiton by clicking update. ButtonTester update = new ButtonTester("btnUpdate", CurrentWebForm); update.Click(); testDynamicListAdmin("DynamicListForArticle"); string xml; int id = 0; getDynamicListDefinitionXML("DynamicListForArticle", out xml, out id); if (id > 0) { _dynamicLists.Add(id, "DynamicListForArticle"); } //Validate the Dynamic list Definition Xml. DnaXmlValidator validator = new DnaXmlValidator(xml, "DynamicListForArticle.xsd"); validator.Validate(); //Bring up the edit page and check it displays the list. relativePath = @"/dna/haveyoursay/EditDynamicListDefinition?id=" + id.ToString(); _dnarequest.RequestNUnitASPPage(relativePath, Browser); TextBoxTester checkname = new TextBoxTester("txtName", CurrentWebForm); string dlistname = checkname.Text; Assert.AreEqual(dlistname, "DynamicListForArticle", "Name does not match"); //Publish the Dynamic List. relativePath = @"/dna/haveyoursay/DynamicListAdmin?activateid=" + id.ToString(); _dnarequest.RequestNUnitASPPage(relativePath, Browser); }
public override void InsertTest() { NewBtn.Click(); TextBoxTester Nazwa = new TextBoxTester("ctl01_NazwaEdit", CurrentWebForm); TextBoxTester Opis = new TextBoxTester("ctl01_OpisEdit", CurrentWebForm); Zalacznik z2i = Zalacznik.GetWellKnown(); string unNazwa = Guid.NewGuid().ToString(); string unOpis = Guid.NewGuid().ToString(); z2i.Nazwa = unNazwa; z2i.Opis = unOpis; Nazwa.Text = z2i.Nazwa; Opis.Text = z2i.Opis; SaveBtn.Click(); IsTrue(int.Parse(sessionLbl.Text) > 0, "Niezapisano nowego rekordu"); Zalacznik zalacznikFromDb = Dm.Retrieve<Zalacznik>(int.Parse(sessionLbl.Text)); AreEqual(z2i.Nazwa, zalacznikFromDb.Nazwa, "nazwa"); AreEqual(z2i.Opis, zalacznikFromDb.Opis, "opis"); zalacznikFromDb.Delete(); }
public void Test01MemberListPage() { Console.WriteLine("Before Test01MemberListPage"); _dnarequest.SetCurrentUserEditor(); _dnarequest.UseEditorAuthentication = true; string relativePath = @"/dna/haveyoursay/MemberList"; _dnarequest.RequestNUnitASPPage(relativePath, Browser); TextBoxTester entry = new TextBoxTester("txtEntry", CurrentWebForm); Assert.AreEqual(entry.Visible, true); entry.Text = "1090558354"; RadioButtonListTester radiolist = new RadioButtonListTester("rdSearchType"); Assert.AreEqual(radiolist.Visible, true); radiolist.SelectedIndex = 0; ButtonTester search = new ButtonTester("Search", CurrentWebForm); LabelTester err = new LabelTester("lblError",CurrentWebForm); Assert.AreNotEqual("Insufficient permissions - Editor Status Required", err.Text); Console.WriteLine("After Test01MemberListPage"); }
public static void SetData(Stypendysta s, string prefix, WebForm currentWebForm) { TextBoxTester imie = new TextBoxTester(GetCtrlId(prefix, "ImieEdit"), currentWebForm); TextBoxTester imie2 = new TextBoxTester(GetCtrlId(prefix, "Imie2Edit"), currentWebForm); TextBoxTester nazwisko = new TextBoxTester(GetCtrlId(prefix, "NazwiskoEdit"), currentWebForm); TextBoxTester pesel = new TextBoxTester(GetCtrlId(prefix, "PeselEdit"), currentWebForm); TextBoxTester nip = new TextBoxTester(GetCtrlId(prefix, "NipEdit"), currentWebForm); DropDownListTester szkola = new DropDownListTester(GetCtrlId(prefix, "SzkolaEdit"), currentWebForm); LabelTester uzytkownikWprowadzajacy = new LabelTester(GetCtrlId(prefix, "UzytkownikWprowadzajacyEdit"), currentWebForm); LabelTester dataWprowadzenia = new LabelTester(GetCtrlId(prefix, "DataWprowadzeniaEdit"), currentWebForm); imie.Text = s.Imie; imie2.Text = s.Imie2; nazwisko.Text = s.Nazwisko; pesel.Text = s.Pesel; nip.Text = s.Nip; szkola.SelectedValue = s.Szkola.Id.ToString(); //uzytkownikWprowadzajacy.Text = s.UzytkownikWprowadzajacy; //dataWprowadzenia.Text = s.DataWprowadzenia.ToString(); AdresComponentTest.SetData(s.AdresZameldowania, prefix + "_ctl01", currentWebForm); KontaktComponentTest.SetData(s.Kontakt, prefix + "_ctl00", currentWebForm); }
protected override void SetUp() { button = new ButtonTester("LokalizacjaGrid_SearchBtn", CurrentWebForm); filterValue = new TextBoxTester("LokalizacjaGrid_ValueTxt", CurrentWebForm); next = new MyLinkTester("Next", CurrentWebForm); prev = new MyLinkTester("Prev", CurrentWebForm); last = new MyLinkTester("Last", CurrentWebForm); first = new MyLinkTester("First", CurrentWebForm); // itemsCount = new LabelTester("ItemsCount", CurrentWebForm); currentPage = new LabelTester("CurrentPage", CurrentWebForm); filterField = new DropDownListTester("LokalizacjaGrid_FilterList", CurrentWebForm); Dm.DeleteSql<Lokalizacja>("Nazwa like 'SSS%'"); Lokalizacja l1; for (int i = 0; i < 80; i++) { l1 = Lokalizacja.GetWellKnown(); l1.Nazwa = "SSS" + i.ToString().PadLeft(3, '0'); l1.Skrot = "LP" + i.ToString().PadLeft(3, '0'); l1.Save(null); } base.SetUp(); }
public void Test08MemberListSearchByBBCUIDPage() { Console.WriteLine("Before Test08MemberListSearchByBBCUIDPage"); _dnarequest.SetCurrentUserEditor(); _dnarequest.UseEditorAuthentication = true; string relativePath = @"/dna/haveyoursay/MemberList"; _dnarequest.RequestNUnitASPPage(relativePath, Browser); TextBoxTester entry = new TextBoxTester("txtEntry", CurrentWebForm); Assert.AreEqual(entry.Visible, true); entry.Text = "47C7CDBE-9D79-1517-50CA-0003BA0B17ED"; RadioButtonListTester radiolist = new RadioButtonListTester("rdSearchType", CurrentWebForm); Assert.AreEqual(radiolist.Visible, true); int index = GetSelectedIndex(radiolist, "BBCUID"); radiolist.SelectedIndex = index; ButtonTester search = new ButtonTester("Search", CurrentWebForm); search.Click(); Console.WriteLine("After Test08MemberListSearchByBBCUIDPage"); }
public void Test05MemberListSearchByEmailPage() { Console.WriteLine("Before Test05MemberListSearchByEmailPage"); _dnarequest.SetCurrentUserEditor(); _dnarequest.UseEditorAuthentication = true; string relativePath = @"/dna/haveyoursay/MemberList"; _dnarequest.RequestNUnitASPPage(relativePath, Browser); CurrentWebForm.Variables.Add("d_identityuserid", "dotneteditor"); TextBoxTester entry = new TextBoxTester("txtEntry", CurrentWebForm); Assert.AreEqual(entry.Visible, true); entry.Text = "*****@*****.**"; RadioButtonListTester radiolist = new RadioButtonListTester("rdSearchType", CurrentWebForm); Assert.AreEqual(radiolist.Visible, true); int index = GetSelectedIndex(radiolist, "Email"); radiolist.SelectedIndex = index; ButtonTester search = new ButtonTester("Search", CurrentWebForm); search.Click(); HtmlTableTester table = new HtmlTableTester("tblResults"); bool found = false; if (table.BodyNoTags != "No data for those details") { for (int i = 1; i < table.Rows.Length; i++) { HtmlTagTester htmltag = (HtmlTagTester)table.Rows[i].Children("td").GetValue(1); string userID = htmltag.InnerHtml; string testSuperUserIDLink = "<a href=\"/dna/moderation/MemberDetails?userid=" + testSuperUserID.ToString() + "\">U" + testSuperUserID.ToString() + "</a>"; if (userID == testSuperUserIDLink) { found = true; } } Assert.IsTrue(found, "User " + testSuperUserID.ToString() + ": Not returned and displayed in Member List Page."); } else { Assert.IsTrue(false, "Error no results returned."); } Console.WriteLine("After Test05MemberListSearchByEmailPage"); }
protected override void SetUp() { textBox = new TextBoxTester("textBox", CurrentWebForm); multiline = new TextBoxTester("multiline", CurrentWebForm); disabled = new TextBoxTester("disabled", CurrentWebForm); postback = new ButtonTester("postback", CurrentWebForm); Browser.GetPage(BaseUrl + "AspTester/TextBoxTestPage.aspx"); }
protected override void SetUp() { base.SetUp(); Browser.GetPage(BaseUrl + "AspTester/ValidationSummaryTestPage.aspx"); textBox1 = new TextBoxTester("textbox1", CurrentWebForm); textBox2 = new TextBoxTester("textbox2", CurrentWebForm); textBox3 = new TextBoxTester("textbox3", CurrentWebForm); bulletedSummary = new ValidationSummaryTester("bulletedSummary", CurrentWebForm); listSummary = new ValidationSummaryTester("listSummary", CurrentWebForm); button = new ButtonTester("submit", CurrentWebForm); }
protected override void SetUp() { multiline = new TextBoxTester("MultiLineTextBox", CurrentWebForm); doPostBack = new ButtonTester("DoPostBackButton", CurrentWebForm); Browser.GetPage(BaseUrl + "MultiLineTextInput.aspx"); }
public override void EditTest() { LabelTester Nazwa = new LabelTester("ctl02_Nazwa", CurrentWebForm); LabelTester Ulica = new LabelTester("ctl02_ctl00_Ulica", CurrentWebForm); LabelTester Tel = new LabelTester("ctl02_ctl01_Tel", CurrentWebForm); TextBoxTester NazwaEdit = new TextBoxTester("ctl02_NazwaEdit", CurrentWebForm); TextBoxTester UlicaEdit = new TextBoxTester("ctl02_ctl00_UlicaEdit", CurrentWebForm); TextBoxTester TelEdit = new TextBoxTester("ctl02_ctl01_TelEdit", CurrentWebForm); Lokalizacja l = Lokalizacja.GetWellKnown(); l.Save(null); int idLokalizacja = l.Id; IdTb.Text = l.Id.ToString(); PostBtn.Click(); Assert.AreEqual(l.Nazwa, Nazwa.Text, "z³a nazwa lokalizacji"); Assert.AreEqual(l.Adres.Ulica, Ulica.Text, "ulica"); Assert.AreEqual(l.Kontakt.Tel, Tel.Text, "tel"); string guidNazwa = Guid.NewGuid().ToString(); string guidUlica = Guid.NewGuid().ToString(); string guidTelefon = UnikalnyNumerTelefonu(); EditBtn.Click(); NazwaEdit.Text = guidNazwa; UlicaEdit.Text = guidUlica; TelEdit.Text = guidTelefon; SaveBtn.Click(); Dm.ObjectSpace.ClearTracking(); Lokalizacja lFromDb = Dm.Retrieve<Lokalizacja>(idLokalizacja); int idAdres = (int)lFromDb.IdAdres; int idKontakt = (int)lFromDb.IdKontakt; Assert.AreEqual(guidNazwa, lFromDb.Nazwa, "nazwa"); Assert.AreEqual(guidTelefon, lFromDb.Kontakt.Tel, "telefon"); Assert.AreEqual(guidUlica, lFromDb.Adres.Ulica, "ulica"); lFromDb.Delete(); Adres a = Dm.Retrieve<Adres>(idAdres); a.Delete(); Kontakt k = Dm.Retrieve<Kontakt>(idKontakt); k.Delete(); }
public static void SetData(Adres a, string prefix, WebForm currentWebForm) { TextBoxTester Powiat = new TextBoxTester(GetCtrlId(prefix, "PowiatEdit"), currentWebForm); TextBoxTester Kod = new TextBoxTester(GetCtrlId(prefix, "KodEdit"), currentWebForm); TextBoxTester Gus = new TextBoxTester(GetCtrlId(prefix, "GusEdit"), currentWebForm); TextBoxTester Kraj = new TextBoxTester(GetCtrlId(prefix, "KrajEdit"), currentWebForm); TextBoxTester Ulica = new TextBoxTester(GetCtrlId(prefix, "UlicaEdit"), currentWebForm); TextBoxTester Gmina = new TextBoxTester(GetCtrlId(prefix, "GminaEdit"), currentWebForm); TextBoxTester Wojewodztwo = new TextBoxTester(GetCtrlId(prefix, "WojewodztwoEdit"), currentWebForm); TextBoxTester Poczta = new TextBoxTester(GetCtrlId(prefix, "PocztaEdit"), currentWebForm); TextBoxTester Miejscowosc = new TextBoxTester(GetCtrlId(prefix, "MiejscowoscEdit"), currentWebForm); Miejscowosc.Text = a.Miejscowosc; Powiat.Text = a.Powiat; Kod.Text = a.Kod; Gus.Text = a.Gus; Kraj.Text = a.Kraj; Ulica.Text = a.Ulica; Gmina.Text = a.Gmina; Wojewodztwo.Text = a.Wojewodztwo; Poczta.Text = a.Poczta; }
public void TestRequiredFieldValidator() { RequiredFieldValidatorTester rfvName = new RequiredFieldValidatorTester("rfvName", CurrentWebForm); TextBoxTester txtName = new TextBoxTester("txtName", CurrentWebForm); WebAssert.NotVisible(rfvName, "should not be visible at start"); txtName.Text = ""; btnSubmit.Click(); AssertVisibility(rfvName, true); AssertEquals("Name is required", rfvName.ErrorMessage); }
/// <summary> /// Executed before each test method is run. Override in subclasses to do subclass /// set up. NOTE: [SetUp] attribute cannot be used in subclasses because it is already /// in use. /// </summary> protected override void SetUp() { PostBtn = new ButtonTester("PostBtn", CurrentWebForm); SaveBtn = new ButtonTester("SaveBtn", CurrentWebForm); NewBtn = new ButtonTester("NewBtn", CurrentWebForm); EditBtn = new ButtonTester("EditBtn", CurrentWebForm); DelBtn = new ButtonTester("DelBtn", CurrentWebForm); IdTb = new TextBoxTester("IdTb", CurrentWebForm); sessionLbl = new LabelTester("SessionLbl", CurrentWebForm); Powiat = new TextBoxTester("ctl02_PowiatEdit", CurrentWebForm); Kod = new TextBoxTester("ctl02_KodEdit", CurrentWebForm); Gus = new TextBoxTester("ctl02_GusEdit", CurrentWebForm); Kraj = new TextBoxTester("ctl02_KrajEdit", CurrentWebForm); Ulica = new TextBoxTester("ctl02_UlicaEdit", CurrentWebForm); Gmina = new TextBoxTester("ctl02_GminaEdit", CurrentWebForm); Wojewodztwo = new TextBoxTester("ctl02_WojewodztwoEdit", CurrentWebForm); Poczta = new TextBoxTester("ctl02_PocztaEdit", CurrentWebForm); Miejscowosc = new TextBoxTester("ctl02_MiejscowoscEdit", CurrentWebForm); PowiatLbl = new LabelTester("ctl02_Powiat", CurrentWebForm); KodLbl = new LabelTester("ctl02_Kod", CurrentWebForm); GusLbl = new LabelTester("ctl02_Gus", CurrentWebForm); KrajLbl = new LabelTester("ctl02_Kraj", CurrentWebForm); UlicaLbl = new LabelTester("ctl02_Ulica", CurrentWebForm); GminaLbl = new LabelTester("ctl02_Gmina", CurrentWebForm); WojewodztwoLbl = new LabelTester("ctl02_Wojewodztwo", CurrentWebForm); PocztaLbl = new LabelTester("ctl02_Poczta", CurrentWebForm); MiejscowoscLbl = new LabelTester("ctl02_Miejscowosc", CurrentWebForm); base.SetUp(); }
public override void InsertTest() { TextBoxTester Nazwa = new TextBoxTester("ctl02_NazwaEdit", CurrentWebForm); TextBoxTester Skrot = new TextBoxTester("ctl02_SkrotEdit", CurrentWebForm); TextBoxTester Poczta = new TextBoxTester("ctl02_ctl00_PocztaEdit", CurrentWebForm); TextBoxTester Wojewodztwo = new TextBoxTester("ctl02_ctl00_WojewodztwoEdit", CurrentWebForm); TextBoxTester Gmina = new TextBoxTester("ctl02_ctl00_GminaEdit", CurrentWebForm); TextBoxTester Ulica = new TextBoxTester("ctl02_ctl00_UlicaEdit", CurrentWebForm); TextBoxTester Kraj = new TextBoxTester("ctl02_ctl00_KrajEdit", CurrentWebForm); TextBoxTester Kod = new TextBoxTester("ctl02_ctl00_KodEdit", CurrentWebForm); TextBoxTester Powiat = new TextBoxTester("ctl02_ctl00_PowiatEdit", CurrentWebForm); TextBoxTester Gus = new TextBoxTester("ctl02_ctl00_GusEdit", CurrentWebForm); TextBoxTester Miejscowosc = new TextBoxTester("ctl02_ctl00_MiejscowoscEdit", CurrentWebForm); TextBoxTester Tel = new TextBoxTester("ctl02_ctl01_TelEdit", CurrentWebForm); TextBoxTester Tel2 = new TextBoxTester("ctl02_ctl01_Tel2Edit", CurrentWebForm); TextBoxTester Fax = new TextBoxTester("ctl02_ctl01_FaxEdit", CurrentWebForm); TextBoxTester Www = new TextBoxTester("ctl02_ctl01_WwwEdit", CurrentWebForm); TextBoxTester Email = new TextBoxTester("ctl02_ctl01_EmailEdit", CurrentWebForm); NewBtn.Click(); string guidNazwa = Guid.NewGuid().ToString(); string guidUlica = Guid.NewGuid().ToString(); string guidTelefon = UnikalnyNumerTelefonu(); Lokalizacja l2i = Lokalizacja.GetWellKnown(); l2i.Nazwa = guidNazwa; l2i.Adres.Ulica = guidUlica; l2i.Kontakt.Tel = guidTelefon; Nazwa.Text = l2i.Nazwa; Skrot.Text = l2i.Skrot; Poczta.Text = l2i.Adres.Poczta ; Wojewodztwo.Text = l2i.Adres.Wojewodztwo; Gmina.Text = l2i.Adres.Gmina; Ulica.Text = l2i.Adres.Ulica; Kraj.Text = l2i.Adres.Kraj; Kod.Text = l2i.Adres.Kod; Powiat.Text = l2i.Adres.Powiat; Gus.Text = l2i.Adres.Gus; Miejscowosc.Text = l2i.Adres.Miejscowosc; Tel.Text = l2i.Kontakt.Tel; Tel2.Text = l2i.Kontakt.Tel2; Fax.Text = l2i.Kontakt.Fax; Www.Text = l2i.Kontakt.Www; Email.Text = l2i.Kontakt.Email; SaveBtn.Click(); Assert.IsTrue(int.Parse(sessionLbl.Text) > 0, "Niezapisano nowego rekordu"); int idLokalizacja = 0; if (int.TryParse(sessionLbl.Text,out idLokalizacja)) if (idLokalizacja > 0) { Dm.ObjectSpace.ClearTracking(); Lokalizacja lFromDb = Dm.Retrieve<Lokalizacja>(idLokalizacja); int idAdres = (int)lFromDb.IdAdres; int idKontakt = (int)lFromDb.IdKontakt; Assert.AreEqual(l2i.Nazwa, lFromDb.Nazwa, "nazwa"); Assert.AreEqual(l2i.Skrot, lFromDb.Skrot, "skrót"); Assert.AreEqual(l2i.Kontakt.Fax, lFromDb.Kontakt.Fax, "fax"); Assert.AreEqual(l2i.Kontakt.Tel, lFromDb.Kontakt.Tel, "telefon"); Assert.AreEqual(l2i.Kontakt.Tel2, lFromDb.Kontakt.Tel2, "telefon 2"); Assert.AreEqual(l2i.Kontakt.Email, lFromDb.Kontakt.Email, "e-mail"); Assert.AreEqual(l2i.Kontakt.Www, lFromDb.Kontakt.Www, "WWW"); Assert.AreEqual(l2i.Adres.Poczta, lFromDb.Adres.Poczta, "poczta"); Assert.AreEqual(l2i.Adres.Wojewodztwo, lFromDb.Adres.Wojewodztwo, "woj"); Assert.AreEqual(l2i.Adres.Gmina, lFromDb.Adres.Gmina, "gmi"); Assert.AreEqual(l2i.Adres.Ulica, lFromDb.Adres.Ulica, "ulica"); Assert.AreEqual(l2i.Adres.Kraj, lFromDb.Adres.Kraj, "kraj"); Assert.AreEqual(l2i.Adres.Kod, lFromDb.Adres.Kod, "kod"); Assert.AreEqual(l2i.Adres.Powiat, lFromDb.Adres.Powiat, "powiat"); Assert.AreEqual(l2i.Adres.Gus, lFromDb.Adres.Gus, "gus"); Assert.AreEqual(l2i.Adres.Miejscowosc, lFromDb.Adres.Miejscowosc, "msc"); lFromDb.Delete(); Adres a = Dm.Retrieve<Adres>(idAdres); a.Delete(); Kontakt k = Dm.Retrieve<Kontakt>(idKontakt); k.Delete(); } }
protected override void SetUp() { PostBtn = new ButtonTester("PostBtn", CurrentWebForm); NewBtn = new ButtonTester("NewBtn", CurrentWebForm); EditBtn = new ButtonTester("EditBtn", CurrentWebForm); DelBtn = new ButtonTester("DelBtn", CurrentWebForm); SaveBtn = new ButtonTester("SaveBtn", CurrentWebForm); CancelBtn = new ButtonTester("CancelBtn", CurrentWebForm); IdTb = new TextBoxTester("IdTb", CurrentWebForm); sessionLbl = new LabelTester("SessionLbl", CurrentWebForm); base.SetUp(); }
private void RunTest() { TextBoxTester textBox1 = new TextBoxTester("textBox1", CurrentWebForm); TextBoxTester textBox2 = new TextBoxTester("textBox2", CurrentWebForm); TextBoxTester textBox3 = new TextBoxTester("textBox3", CurrentWebForm); TextBoxTester textBox4 = new TextBoxTester("textBox4", CurrentWebForm); TextBoxTester textBox5 = new TextBoxTester("textBox5", CurrentWebForm); ButtonTester button = new ButtonTester("button", CurrentWebForm); Browser.GetPage(BaseUrl + "PerformanceTestPage.aspx"); AssertEquals("textBox1", "textBox1", textBox1.Text); AssertEquals("textBox2", "textBox2", textBox2.Text); AssertEquals("textBox3", "textBox3", textBox3.Text); AssertEquals("textBox4", "textBox4", textBox4.Text); AssertEquals("textBox5", "textBox5", textBox5.Text); textBox1.Text = "not 1"; textBox2.Text = "not 2"; textBox3.Text = "not 3"; textBox4.Text = "not 4"; textBox5.Text = "not 5"; button.Click(); AssertEquals("textBox1", "not 1", textBox1.Text); AssertEquals("textBox2", "not 2", textBox2.Text); AssertEquals("textBox3", "not 3", textBox3.Text); AssertEquals("textBox4", "not 4", textBox4.Text); AssertEquals("textBox5", "not 5", textBox5.Text); }
public void TransferAfterSetResult() { TextBoxTester name = new TextBoxTester("name", CurrentWebForm); ButtonTester save = new ButtonTester("save", CurrentWebForm); Browser.GetPage("asptest://localhost/TransferAfterSetResult.aspx"); // Note, that page TransferAfterSetResultSave.aspx has 'EnableViewStateMac="false"' // otherwise ViewState validation will fail on a Server.Transfer during a Postback! save.Click(); string result = Browser.CurrentPageText; Assert.AreEqual("OK", result); }
public void TestValidation_WhenClientSideScriptIsTrue_AndDisplayIsStatic() { RequiredFieldValidatorTester staticClientSideValidator = new RequiredFieldValidatorTester("staticClientSideValidator"); TextBoxTester staticClientSideTextBox = new TextBoxTester("staticClientSideTextBox"); WebAssert.NotVisible(staticClientSideValidator, "should not be visible at start"); btnSubmit.Click(); WebAssert.Visible(staticClientSideValidator, "should be visible after submit"); staticClientSideTextBox.Text = "stuff"; btnSubmit.Click(); WebAssert.NotVisible(staticClientSideValidator, "should not be visible after filled in"); }
public void TestRegularExpressionValidator() { RegularExpressionValidatorTester revPhone = new RegularExpressionValidatorTester("revPhone", CurrentWebForm); TextBoxTester txtPhone = new TextBoxTester("txtPhone", CurrentWebForm); WebAssert.NotVisible(revPhone, "should not be visible at start"); txtPhone.Text = "556 334-4456"; btnSubmit.Click(); AssertVisibility(revPhone, true); AssertEquals("Phone must be in (###) ###-#### format", revPhone.ErrorMessage); }
protected override void SetUp() { button=new ButtonTester("WniosekList1_SearchBtn", CurrentWebForm); filterValue = new TextBoxTester("WniosekList1_ValueTxt", CurrentWebForm); next = new MyLinkTester("Next", CurrentWebForm); prev = new MyLinkTester("Prev", CurrentWebForm); last = new MyLinkTester("Last", CurrentWebForm); first = new MyLinkTester("First", CurrentWebForm); itemsCount = new LabelTester("ItemsCount", CurrentWebForm); currentPage = new LabelTester("CurrentPage", CurrentWebForm); filterField = new DropDownListTester("WniosekList1_FilterList", CurrentWebForm); Dm.DeleteSql<Wniosek>("Sygnatura like 'SS%'"); Wniosek w1; for (int i = 0; i < 80; i++) { w1 = Wniosek.GetWellKnown("olo", DateTime.Now); w1.Sygnatura = "SS" + i.ToString().PadLeft(3, '0'); w1.Wnioskodawca.Pesel = "WP" + i.ToString().PadLeft(3, '0'); w1.Wnioskodawca.Nazwisko = "WN" + i.ToString().PadLeft(3, '0'); w1.Stypendysta.Pesel = "SP" + i.ToString().PadLeft(3, '0'); w1.Stypendysta.Nazwisko = "SN" + i.ToString().PadLeft(3, '0'); w1.Save(null); } base.SetUp(); }