public void ComboBoxEnter() { Form f = new ComboBoxTestForm(); f.Show(); TestWriter writer = new TestWriter(f); Assert.Equal("", writer.Test); ComboBoxTester comboBox = new ComboBoxTester("myComboBox"); //doing 2 of these tests the collapsing processor. comboBox.Enter("abc"); comboBox.Enter("abcd"); Assert.Equal( @"[Fact] public void Test() { ComboBoxTester myComboBox = new ComboBoxTester(""myComboBox""); myComboBox.Enter(""abcd""); }", writer.Test); }
public void RevertingToEnglish_Works() { string path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); try { ComboBoxTester t = CreateNewAndGetLanguageCombo(path); //select the last one t.Properties.SelectedItem = t.Properties.Items[t.Properties.Items.Count - 1]; CloseApp(); //now reopen, close before going to ui language tab OpenExisting(path); t = GoToTabAndGetLanguageCombo(); t.Properties.SelectedItem = FindDefaultEnglishItem(t.Properties); CloseApp(); //now reopen, this time go to uilanguage OpenExisting(path); t = GoToTabAndGetLanguageCombo(); Assert.AreEqual("English (Default)", t.Properties.SelectedItem.ToString()); } finally { CloseApp(); Palaso.TestUtilities.TestUtilities.DeleteFolderThatMayBeInUse(path); } }
public void ComboBoxEnter() { Form f = new ComboBoxTestForm(); f.Show(); TestWriter writer = new TestWriter(f); Assert.Equal("", writer.Test); ComboBoxTester comboBox = new ComboBoxTester("myComboBox"); //doing 2 of these tests the collapsing processor. comboBox.Enter("abc"); comboBox.Enter("abcd"); Assert.Equal( @"[Fact] public void Test() { ComboBoxTester myComboBox = new ComboBoxTester(""myComboBox""); myComboBox.Enter(""abcd""); }", writer.Test); }
public void ComboBoxEnterAndSelect() { Form f = new ComboBoxTestForm(); f.Show(); TestWriter writer = new TestWriter(f); Assert.AreEqual("", writer.Test); ComboBoxTester comboBox = new ComboBoxTester("myComboBox"); //doing 2 of these tests the collapsing processor. comboBox.Select(1); comboBox.Enter("abcd"); comboBox.Enter("abcde"); comboBox.Select(2); Assert.AreEqual( @"[Test] public void Test() { ComboBoxTester myComboBox = new ComboBoxTester(""myComboBox""); myComboBox.Select(1); //two myComboBox.Enter(""abcde""); myComboBox.Select(2); //three }", writer.Test); }
private ComboBoxTester GoToTabAndGetLanguageCombo() { GoToUILanguageTab(); var t = new ComboBoxTester("_languageCombo", _window); return(t); }
public void Test_EnterDataDatesAndApply() { Assert.AreEqual(fTaskRecord, fDialog.Task); var txtPriority = new ComboBoxTester("txtPriority", fDialog); txtPriority.Select(1); var txtStartDate = new MaskedTextBoxTester("txtStartDate", fDialog); txtStartDate.Enter("01.01.2000"); var txtStopDate = new MaskedTextBoxTester("txtStopDate", fDialog); txtStopDate.Enter("20.02.2000"); var cmbGoalType = new ComboBoxTester("cmbGoalType", fDialog); for (GKGoalType gt = GKGoalType.gtIndividual; gt <= GKGoalType.gtOther; gt++) { cmbGoalType.Select((int)gt); } ClickButton("btnAccept", fDialog); Assert.AreEqual(GKResearchPriority.rpLow, fTaskRecord.Priority); Assert.AreEqual("01 JAN 2000", fTaskRecord.StartDate.StringValue); Assert.AreEqual("20 FEB 2000", fTaskRecord.StopDate.StringValue); }
// /// <summary> // /// simple test to create a batch and save it // /// </summary> // [Test] // public void TestCreateBatchAndSave() // { // TFrmGiftBatch frmBatch = new TFrmGiftBatch(IntPtr.Zero); // // frmBatch.LedgerNumber = FLedgerNumber; // frmBatch.Show(); // // ToolStripButtonTester btnSave = new ToolStripButtonTester("tbbSave"); // ButtonTester btnNewBatch = new ButtonTester("ucoBatches.btnNew"); // // Assert.AreEqual(false, btnSave.Properties.Enabled, "Save button should be disabled since there are no changes"); // btnNewBatch.Click(); // // TextBoxTester txtDetailBatchDescription = new TextBoxTester("txtDetailBatchDescription"); // txtDetailBatchDescription.Properties.Text = "Created by test TestCreateBatchAndSave"; // // Assert.AreEqual(true, btnSave.Properties.Enabled, "Save button should be enabled since there was a change"); // btnSave.Click(); // } private void ImportGiftBatch(string TestFile) { TestFile = Path.GetFullPath(TestFile); Assert.IsTrue(File.Exists(TestFile), "File does not exist: " + TestFile); ModalFormHandler = delegate(string name, IntPtr hWnd, Form form) { OpenFileDialogTester tester = new OpenFileDialogTester(hWnd); ModalFormHandler = delegate(string name2, IntPtr hWnd2, Form form2) { TDlgSelectCSVSeparatorTester tester2 = new TDlgSelectCSVSeparatorTester(hWnd2); TextBoxTester txtDateFormat = new TextBoxTester("txtDateFormat"); txtDateFormat.Properties.Text = "MM/dd/yyyy"; RadioButtonTester rbtSemicolon = new RadioButtonTester("rbtSemicolon"); rbtSemicolon.Properties.Checked = true; ComboBoxTester cmbNumberFormat = new ComboBoxTester("cmbNumberFormat"); cmbNumberFormat.Select(0); ButtonTester btnOK = new ButtonTester("btnOK", tester2.Properties.Name); ModalFormHandler = delegate(string name3, IntPtr hWnd3, Form form3) { MessageBoxTester tester3 = new MessageBoxTester(hWnd3); Assert.AreEqual("Success", tester3.Title); tester3.SendCommand(MessageBoxTester.Command.OK); }; btnOK.Click(); }; tester.OpenFile(TestFile); }; ToolStripButtonTester btnImport = new ToolStripButtonTester("tbbImportBatches"); btnImport.Click(); }
public void ComboBoxEnterAndSelect() { Form f = new ComboBoxTestForm(); f.Show(); TestWriter writer = new TestWriter(f); Assert.AreEqual("", writer.Test); ComboBoxTester comboBox = new ComboBoxTester("myComboBox"); //doing 2 of these tests the collapsing processor. comboBox.Select(1); comboBox.Enter("abcd"); comboBox.Enter("abcde"); comboBox.Select(2); Assert.AreEqual( @"[Test] public void Test() { ComboBoxTester myComboBox = new ComboBoxTester(""myComboBox""); myComboBox.Select(1); //two myComboBox.Enter(""abcde""); myComboBox.Select(2); //three }", writer.Test); }
public void Test_EnterDataAndApply() { // Empty dates Assert.AreEqual(fResearchRecord, fDialog.Research); var txtName = new TextBoxTester("txtName", fDialog); txtName.Enter("sample text"); var cmbPriority = new ComboBoxTester("cmbPriority", fDialog); cmbPriority.Select(1); var cmbStatus = new ComboBoxTester("cmbStatus", fDialog); cmbStatus.Select(1); var nudPercent = new NumericUpDownTester("nudPercent", fDialog); nudPercent.EnterValue(11); // The links to other records can be added or edited only in MainWinTests // (where there is a complete infrastructure of the calls to BaseWin.ModifyX) ClickButton("btnAccept", fDialog); Assert.AreEqual("sample text", fResearchRecord.ResearchName); Assert.AreEqual(GKResearchPriority.rpLow, fResearchRecord.Priority); Assert.AreEqual(GKResearchStatus.rsInProgress, fResearchRecord.Status); Assert.AreEqual(11, fResearchRecord.Percent); Assert.AreEqual("", fResearchRecord.StartDate.StringValue); Assert.AreEqual("", fResearchRecord.StopDate.StringValue); }
private void MaximalWizard() { var associationTypeComboBoxTester = new ComboBoxTester(Constants.AddRelationTypeWizard, Constants.AssociationTypeComboBox); associationTypeComboBoxTester.Select("Company"); var associationSingularNameTextBoxTester = new TextBoxTester(Constants.AddRelationTypeWizard, Constants.AssociationSingularNameTextBox); associationSingularNameTextBoxTester.Target.Text = "Employer"; var associationPluralNameTextBoxTester = new TextBoxTester(Constants.AddRelationTypeWizard, Constants.AssociationPluralNameTextBox); associationPluralNameTextBoxTester.Target.Text = "Employers"; var roleTypeComboBoxTester = new ComboBoxTester(Constants.AddRelationTypeWizard, Constants.RoleTypeComboBox); roleTypeComboBoxTester.Select("Person"); var roleSingularNameTextBoxTester = new TextBoxTester(Constants.AddRelationTypeWizard, Constants.RoleSingularNameTextBox); roleSingularNameTextBoxTester.Target.Text = "Employee"; var rolePluralNameTextBoxTester = new TextBoxTester(Constants.AddRelationTypeWizard, Constants.RolePluralNameTextBox); rolePluralNameTextBoxTester.Target.Text = "Employees"; var multiplicityComboBoxTester = new ComboBoxTester(Constants.AddRelationTypeWizard, Constants.MultiplicityComboBox); multiplicityComboBoxTester.Select("One to Many"); var finishButtonTester = new ButtonTester(Constants.AddRelationTypeWizard, Constants.FinishButton); finishButtonTester.Click(); }
public void CycleWithoutGoingToUITab_DoesntLooseLanguageSetting() // Regression for WS599 { string path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); try { ComboBoxTester t = CreateNewAndGetLanguageCombo(path); //select the last one t.Properties.SelectedItem = t.Properties.Items[t.Properties.Items.Count - 1]; string previouslySelected = t.Properties.SelectedItem.ToString(); CloseApp(); //now reopen, close before going to ui language tab OpenExisting(path); CloseApp(); //now reopen, this time go to uilanguage OpenExisting(path); t = GoToTabAndGetLanguageCombo(); Assert.AreEqual(previouslySelected, t.Properties.SelectedItem.ToString()); } finally { CloseApp(); Palaso.TestUtilities.TestUtilities.DeleteFolderThatMayBeInUse(path); } }
public static void AcceptModalHandler(string name, IntPtr ptr, Form form) { var cmbSource = new ComboBoxTester("cmbSource", form); cmbSource.Select(0); ClickButton("btnAccept", form); }
public static void AcceptModalHandler(string name, IntPtr ptr, Form form) { var cmbRelation = new ComboBoxTester("cmbRelation", form); cmbRelation.Enter("sample relation"); ClickButton("btnAccept", form); }
public void Test_EnterDataAndApply() { Assert.AreEqual(fUserRef, fDialog.UserRef); var cmbRef = new ComboBoxTester("cmbRef"); cmbRef.Enter("sample text"); ClickButton("btnAccept", fDialog); Assert.AreEqual("sample text", fUserRef.StringValue); }
public void Test_EnterDataAndApply() { Assert.AreEqual(fFamilyRecord, fDialog.Family); var cmbMarriageStatus = new ComboBoxTester("cmbMarriageStatus", fDialog); cmbMarriageStatus.Select(0); // The links to other records can be added or edited only in MainWinTests // (where there is a complete infrastructure of the calls to BaseWin.ModifyX) ClickButton("btnAccept", fDialog); }
public void NewProject_LanguageChooser_ShowsEnglish() { string path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); try { ComboBoxTester t = CreateNewAndGetLanguageCombo(path); Assert.AreEqual("English (Default)", t.Properties.SelectedItem.ToString()); } finally { CloseApp(); Palaso.TestUtilities.TestUtilities.DeleteFolderThatMayBeInUse(path); } }
public void Test_EnterDataAndApply() { Assert.AreEqual(fAssociation, fDialog.Association); var cmbRelation = new ComboBoxTester("cmbRelation"); cmbRelation.Enter("sample text"); Assert.AreEqual("sample text", cmbRelation.Text); // TODO: click and select Individual reference //ModalFormHandler = RecordSelectDlg_Cancel_Handler; //ClickButton("btnPersonAdd", fDialog); ClickButton("btnAccept", fDialog); Assert.AreEqual("sample text", fAssociation.Relation); Assert.AreEqual(null, fAssociation.Individual); }
public void Test_EnterDataAndApply() { Assert.AreEqual(fCommunicationRecord, fDialog.Communication); var txtName = new TextBoxTester("txtName"); txtName.Enter("sample text"); var cmbCorrType = new ComboBoxTester("cmbCorrType", fDialog); cmbCorrType.Select(1); ClickButton("btnAccept", fDialog); Assert.AreEqual("sample text", fCommunicationRecord.CommName); Assert.AreEqual(GKCommunicationType.ctEMail, fCommunicationRecord.CommunicationType); Assert.AreEqual("", fCommunicationRecord.Date.StringValue); }
public void Test_EnterDataAndApply() { Assert.AreEqual(fBase, fDialog.Base); Assert.AreEqual(fAssociation, fDialog.Association); var cmbRelation = new ComboBoxTester("cmbRelation"); cmbRelation.Enter("sample text"); Assert.AreEqual("sample text", cmbRelation.Text); // TODO: click and select Individual reference /*var txtAuthor = new TextBoxTester("txtAuthor"); * txtAuthor.Enter("sample text"); * Assert.AreEqual("sample text", txtAuthor.Text);*/ ClickButton("btnAccept", fDialog); Assert.AreEqual("sample text", fAssociation.Relation); Assert.AreEqual(null, fAssociation.Individual); }
public void ChangeLanguage_Reopen_HasSameProject() // RegressionTest_WS599() { string path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); try { ComboBoxTester t = CreateNewAndGetLanguageCombo(path); //select the last one t.Properties.SelectedItem = t.Properties.Items[t.Properties.Items.Count - 1]; string previouslySelected = t.Properties.SelectedItem.ToString(); CloseApp(); //now reopen OpenExisting(path); t = GoToTabAndGetLanguageCombo(); Assert.AreEqual(previouslySelected, t.Properties.SelectedItem.ToString()); } finally { CloseApp(); Palaso.TestUtilities.TestUtilities.DeleteFolderThatMayBeInUse(path); } }
public static void EnterCombo(string name, Form form, string value) { var combo = new ComboBoxTester(name, form); combo.Enter(value); }
public static void SelectCombo(string name, Form form, int value) { var combo = new ComboBoxTester(name, form); combo.Select(value); }
public override void Setup() { new ComboBoxTestForm().Show(); box = new ComboBoxTester("myComboBox"); }
public override void Setup() { new ComboBoxTestForm().Show(); box = new ComboBoxTester("myComboBox"); }
private void PersonEditDlg_Handler(PersonEditDlg dlg) { GDMIndividualRecord indiRecord = dlg.Person; SelectCombo("cmbSex", dlg, 1); // male var tabs = new TabControlTester("tabsPersonData", dlg); var cmbRestriction = new ComboBoxTester("cmbRestriction", dlg); cmbRestriction.Select(3); cmbRestriction.Select(2); cmbRestriction.Select(1); cmbRestriction.Select(0); var txtSurname = new TextBoxTester("txtSurname", dlg); txtSurname.FireEvent("KeyDown", new KeyEventArgs(Keys.Down | Keys.Control)); // parents RecordSelectDlgTests.SetCreateItemHandler(this, FamilyEditDlgTests.FamilyAdd_Mini_Handler); ClickButton("btnParentsAdd", dlg); ModalFormHandler = MessageBox_YesHandler; ClickButton("btnParentsDelete", dlg); // father PersonEditDlgTests.SetCreateIndividualHandler(this, GDMSex.svMale); ClickButton("btnFatherAdd", dlg); ModalFormHandler = MessageBox_YesHandler; ClickButton("btnFatherDelete", dlg); // mother PersonEditDlgTests.SetCreateIndividualHandler(this, GDMSex.svFemale); ClickButton("btnMotherAdd", dlg); ModalFormHandler = MessageBox_YesHandler; ClickButton("btnMotherDelete", dlg); ClickButton("btnNameCopy", dlg); // events tabs.SelectTab(0); Assert.AreEqual(1, indiRecord.Events.Count); SetModalFormHandler(this, EventEditDlgTests.EventEditDlg_Select_Handler); ClickToolStripButton("fEventsList_ToolBar_btnAdd", dlg); Assert.AreEqual(2, indiRecord.Events.Count); SelectSheetListItem("fEventsList", dlg, 1); SetModalFormHandler(this, EventEditDlgTests.EventEditDlg_Select_Handler); ClickToolStripButton("fEventsList_ToolBar_btnEdit", dlg); Assert.AreEqual(2, indiRecord.Events.Count); ModalFormHandler = MessageBox_YesHandler; SelectSheetListItem("fEventsList", dlg, 1); ClickToolStripButton("fEventsList_ToolBar_btnDelete", dlg); Assert.AreEqual(1, indiRecord.Events.Count); // spouses tabs.SelectTab(1); Assert.AreEqual(0, indiRecord.SpouseToFamilyLinks.Count); ModalFormHandler = FamilyEditDlgTests.SpouseEdit_Handler; ClickToolStripButton("fSpousesList_ToolBar_btnAdd", dlg); Assert.AreEqual(1, indiRecord.SpouseToFamilyLinks.Count); SelectSheetListItem("fSpousesList", dlg, 1); ModalFormHandler = FamilyEditDlgTests.SpouseEdit_Handler; ClickToolStripButton("fSpousesList_ToolBar_btnEdit", dlg); Assert.AreEqual(1, indiRecord.SpouseToFamilyLinks.Count); SelectSheetListItem("fSpousesList", dlg, 1); ModalFormHandler = MessageBox_YesHandler; ClickToolStripButton("fSpousesList_ToolBar_btnDelete", dlg); Assert.AreEqual(0, indiRecord.SpouseToFamilyLinks.Count); // names tabs.SelectTab(2); Assert.AreEqual(1, indiRecord.PersonalNames.Count); ModalFormHandler = PersonalNameEditDlgTests.NameEditAdd_Handler; ClickToolStripButton("fNamesList_ToolBar_btnAdd", dlg); Assert.AreEqual(2, indiRecord.PersonalNames.Count); Assert.AreEqual("sample surname", indiRecord.PersonalNames[1].Surname); SelectSheetListItem("fNamesList", dlg, 1); ModalFormHandler = PersonalNameEditDlgTests.NameEditEdit_Handler; ClickToolStripButton("fNamesList_ToolBar_btnEdit", dlg); Assert.AreEqual(2, indiRecord.PersonalNames.Count); Assert.AreEqual("sample surname2", indiRecord.PersonalNames[1].Surname); SelectSheetListItem("fNamesList", dlg, 1); ModalFormHandler = MessageBox_YesHandler; ClickToolStripButton("fNamesList_ToolBar_btnDelete", dlg); Assert.AreEqual(1, indiRecord.PersonalNames.Count); // associations tabs.SelectTab(3); Assert.AreEqual(0, indiRecord.Associations.Count); ModalFormHandler = AssociationEditDlgTests.AcceptModalHandler; ClickToolStripButton("fAssociationsList_ToolBar_btnAdd", dlg); Assert.AreEqual(1, indiRecord.Associations.Count); Assert.AreEqual("sample relation", indiRecord.Associations[0].Relation); ModalFormHandler = MessageBox_YesHandler; SelectSheetListItem("fAssociationsList", dlg, 0); ClickToolStripButton("fAssociationsList_ToolBar_btnDelete", dlg); Assert.AreEqual(0, indiRecord.Associations.Count); // groups tabs.SelectTab(4); Assert.AreEqual(0, indiRecord.Groups.Count); RecordSelectDlgTests.SetCreateItemHandler(this, GroupEditDlgTests.GroupAdd_Mini_Handler); ClickToolStripButton("fGroupsList_ToolBar_btnAdd", dlg); Assert.AreEqual(1, indiRecord.Groups.Count); Assert.AreEqual("sample group", fCurBase.Context.Tree.GetPtrValue <GDMGroupRecord>(indiRecord.Groups[0]).GroupName); ModalFormHandler = MessageBox_YesHandler; SelectSheetListItem("fGroupsList", dlg, 0); ClickToolStripButton("fGroupsList_ToolBar_btnDelete", dlg); Assert.AreEqual(0, indiRecord.Groups.Count); StructsDlg_Handler(indiRecord, dlg, tabs, new int[] { 5, 6, 7 }); // userrefs tabs.SelectTab(8); Assert.AreEqual(0, indiRecord.UserReferences.Count); ModalFormHandler = UserRefEditDlgTests.AcceptHandler; ClickToolStripButton("fUserRefList_ToolBar_btnAdd", dlg); Assert.AreEqual(1, indiRecord.UserReferences.Count); Assert.AreEqual("sample reference", indiRecord.UserReferences[0].StringValue); ModalFormHandler = MessageBox_YesHandler; SelectSheetListItem("fUserRefList", dlg, 0); ClickToolStripButton("fUserRefList_ToolBar_btnDelete", dlg); Assert.AreEqual(0, indiRecord.UserReferences.Count); ClickButton("btnAccept", dlg); }