private void AddPatient(Test_Patient test, Patient tempPatient, PatientHousehold household) { ThreadUtilities.RunOnUIThread(new Action(() => { test.Activate(); })); UIUtilities.TypeIntoTextbox(test.text_AgeGroup, tempPatient.PatientAgeGroup); UIUtilities.TypeIntoTextbox(test.text_Ethnicity, tempPatient.PatientEthnicity); UIUtilities.TypeIntoTextbox(test.text_FirstName, tempPatient.PatientFirstName); UIUtilities.TypeIntoTextbox(test.text_Gender, tempPatient.PatientGender); UIUtilities.TypeIntoTextbox(test.text_LastName, tempPatient.PatientLastName); UIUtilities.TypeIntoTextbox(test.text_PatientOQ, tempPatient.PatientOQ); UIUtilities.TypeIntoTextbox(test.text_RelationToHEad, tempPatient.RelationToHead); if (tempPatient.IsHead) { UIUtilities.ClickOnItem(test.check_IsHead); } if (tempPatient.HouseholdID == 0) { UIUtilities.ClickOnItem(test.check_NewHousehold); UIUtilities.TypeIntoTextbox(test.text_county, household.HouseholdCounty); UIUtilities.TypeIntoTextbox(test.text_Income, household.HouseholdIncomeBracket); UIUtilities.TypeIntoTextbox(test.text_HouseholdPop, household.HouseholdPopulation.ToString()); } else { UIUtilities.TypeIntoTextbox(test.text_HouseholdID, tempPatient.HouseholdID.ToString()); } UIUtilities.ClickOnItem(test.button_AddPatient); }
public void TestAddingDuplicatePatient() { Patient tempPatient = new Patient(); tempPatient.PatientOQ = "123451"; tempPatient.PatientFirstName = "Test"; tempPatient.PatientLastName = "McGee"; tempPatient.RelationToHead = "Related"; tempPatient.PatientGender = "Female"; tempPatient.PatientEthnicity = "Pacific Islander"; tempPatient.PatientAgeGroup = "12-17"; tempPatient.IsHead = false; // Premade household PatientHousehold tempHousehold = new PatientHousehold(); tempHousehold.HouseholdCounty = "Box Elder"; tempHousehold.HouseholdIncomeBracket = "$25,000-34,999"; tempHousehold.HouseholdPopulation = 7; // Add the patient with new household Test_Patient tpat = OpenTestPatient(); DeletePatient(tpat, tempPatient.PatientOQ); AddPatient(tpat, tempPatient, tempHousehold); // Open the client window Window_Client window = OpenCreateNewPatient(); // Add the patient UIUtilities.ClickOnItem(window.check_HeadOfHousehold); UIUtilities.TypeIntoTextbox(window.textbox_ClientOQ, tempPatient.PatientOQ); UIUtilities.TypeIntoTextbox(window.textbox_FirstName, tempPatient.PatientFirstName); UIUtilities.TypeIntoTextbox(window.textbox_LastName, tempPatient.PatientLastName); UIUtilities.SelectComboboxItem(window.combobox_AgeGroup, tempPatient.PatientAgeGroup); UIUtilities.SelectComboboxItem(window.combobox_ethnicity, tempPatient.PatientEthnicity); UIUtilities.SelectComboboxItem(window.combobox_Gender, tempPatient.PatientGender); // Check that it added UIUtilities.ClickOnItemNoWait(window.button_AddUpdateClient); UIUtilities.CloseWindow(tpat); ThreadUtilities.RunOnUIThread(new Action(() => { // Is the window still open after clicking, because the error dialog should be showing if (Application.Current.Windows.Count == 0) { Assert.Fail("The window closed down when it should have stayed open after adding a duplicate Patient OQ."); } })); UIUtilities.CloseWindow(window); }
private void DeletePatient(Test_Patient test, string patientOQ) { ThreadUtilities.RunOnUIThread(new Action(() => { test.Activate(); })); UIUtilities.TypeIntoTextbox(test.text_PatientOQ, patientOQ); UIUtilities.ClickOnItem(test.button_DeletePatient); }
private void DeleteHousehold(Test_Patient test, int HouseholdID) { ThreadUtilities.RunOnUIThread(new Action(() => { test.Activate(); })); UIUtilities.TypeIntoTextbox(test.text_HouseholdID, HouseholdID.ToString()); UIUtilities.ClickOnItem(test.button_DeleteHousehold); }
private void FindPatient(Test_Patient test, string patientOQ) { ThreadUtilities.RunOnUIThread(new Action(() => { test.Activate(); })); UIUtilities.TypeIntoTextbox(test.text_PatientOQ, patientOQ); UIUtilities.ClickOnItem(test.button_GetPatient); GeneralUtilities.WaitUntil(() => (bool)Application.Current.Dispatcher.Invoke(new Func <bool>(() => test.IsActive))); }
public void TestNumberOnlyInput() { Window_Client window = OpenCreateNewPatient(); // Household Pop UIUtilities.ClickOnItem(window.check_FirstHouseholdMember); UIUtilities.TypeIntoTextboxNoWait(window.textbox_HouseholdPopulation, "123456789abcdefghijklmnopqrstuvwxyz"); ThreadUtilities.RunOnUIThread(new Action(() => { Assert.AreEqual("123456789", window.textbox_HouseholdPopulation.Text); })); UIUtilities.CloseWindow(window); }
public void TestUsingWrongFamilyOQForHousehold() { // Patient to test with Patient tempPatient = new Patient(); tempPatient.PatientOQ = "123451"; tempPatient.PatientFirstName = "Test"; tempPatient.PatientLastName = "McGee"; tempPatient.RelationToHead = "Related"; tempPatient.PatientGender = "Female"; tempPatient.PatientEthnicity = "Pacific Islander"; tempPatient.PatientAgeGroup = "12-17"; tempPatient.IsHead = false; // Add the temp patient manually, but link to previously-made family member Window_Client window = OpenCreateNewPatient(); UIUtilities.TypeIntoTextbox(window.textbox_FamilyMemberOQ, "01234567"); UIUtilities.TypeIntoTextbox(window.textbox_ClientOQ, tempPatient.PatientOQ); UIUtilities.TypeIntoTextbox(window.textbox_FirstName, tempPatient.PatientFirstName); UIUtilities.TypeIntoTextbox(window.textbox_LastName, tempPatient.PatientLastName); UIUtilities.TypeIntoTextbox(window.textbox_RelationToHead, tempPatient.RelationToHead); UIUtilities.SelectComboboxItem(window.combobox_AgeGroup, tempPatient.PatientAgeGroup); UIUtilities.SelectComboboxItem(window.combobox_ethnicity, tempPatient.PatientEthnicity); UIUtilities.SelectComboboxItem(window.combobox_Gender, tempPatient.PatientGender); UIUtilities.ClickOnItem(window.button_AddUpdateClient); ThreadUtilities.RunOnUIThread(new Action(() => { // Is the window still open after clicking, because the error dialog should be showing if (Application.Current.Windows.Count == 0) { Assert.Fail("The window closed down when it should have stayed open after adding a wrong family OQ."); } })); UIUtilities.CloseWindow(window); }
public void TestAddingNewHousehold() { Patient tempPatient = new Patient(); tempPatient.PatientOQ = "123451"; tempPatient.PatientFirstName = "Test"; tempPatient.PatientLastName = "McGee"; tempPatient.RelationToHead = "Related"; tempPatient.PatientGender = "Female"; tempPatient.PatientEthnicity = "Pacific Islander"; tempPatient.PatientAgeGroup = "12-17"; tempPatient.IsHead = false; // Premade household PatientHousehold tempHousehold = new PatientHousehold(); tempHousehold.HouseholdCounty = "Box Elder"; tempHousehold.HouseholdIncomeBracket = "$25,000-34,999"; tempHousehold.HouseholdPopulation = 7; // Add the patient with new household Test_Patient tpat = OpenTestPatient(); DeletePatient(tpat, tempPatient.PatientOQ); // Open the client window Window_Client window = OpenCreateNewPatient(); // Add the patient UIUtilities.ClickOnItem(window.check_HeadOfHousehold); UIUtilities.TypeIntoTextbox(window.textbox_ClientOQ, tempPatient.PatientOQ); UIUtilities.TypeIntoTextbox(window.textbox_FirstName, tempPatient.PatientFirstName); UIUtilities.TypeIntoTextbox(window.textbox_LastName, tempPatient.PatientLastName); UIUtilities.SelectComboboxItem(window.combobox_AgeGroup, tempPatient.PatientAgeGroup); UIUtilities.SelectComboboxItem(window.combobox_ethnicity, tempPatient.PatientEthnicity); UIUtilities.SelectComboboxItem(window.combobox_Gender, tempPatient.PatientGender); // Add the household UIUtilities.ClickOnItem(window.check_FirstHouseholdMember); UIUtilities.TypeIntoTextbox(window.textbox_HouseholdPopulation, tempHousehold.HouseholdPopulation.ToString()); UIUtilities.SelectComboboxItem(window.combobox_County, tempHousehold.HouseholdCounty); UIUtilities.SelectComboboxItem(window.combobox_IncomeBracket, tempHousehold.HouseholdIncomeBracket); // Check that it added UIUtilities.ClickOnItemNoWait(window.button_AddUpdateClient); // Find the patient FindPatient(tpat, tempPatient.PatientOQ); // Check the values ThreadUtilities.RunOnUIThread(new Action(() => { Assert.AreEqual(tempHousehold.HouseholdCounty, tpat.text_county.Text); Assert.AreEqual(tempHousehold.HouseholdIncomeBracket, tpat.text_Income.Text); Assert.AreEqual(tempHousehold.HouseholdPopulation, int.Parse(tpat.text_HouseholdPop.Text)); })); UIUtilities.CloseWindow(tpat); }
public void TestButtonDisable() { Patient tempPatient = new Patient(); tempPatient.PatientOQ = "1234567890"; tempPatient.PatientFirstName = "Test"; tempPatient.PatientLastName = "McGee"; tempPatient.RelationToHead = "Related"; tempPatient.PatientGender = "Female"; tempPatient.PatientEthnicity = "Pacific Islander"; tempPatient.PatientAgeGroup = "12-17"; tempPatient.IsHead = false; Window_Client window = OpenCreateNewPatient(); // Check that the button is initially disabled CheckAddPatientButtonState(window, false); // Type into all other entry points, so the button is enabled UIUtilities.TypeIntoTextbox(window.textbox_ClientOQ, tempPatient.PatientOQ); UIUtilities.TypeIntoTextbox(window.textbox_FirstName, tempPatient.PatientFirstName); UIUtilities.TypeIntoTextbox(window.textbox_LastName, tempPatient.PatientLastName); UIUtilities.TypeIntoTextbox(window.textbox_RelationToHead, tempPatient.RelationToHead); UIUtilities.TypeIntoTextbox(window.textbox_FamilyMemberOQ, "1234560"); CheckAddPatientButtonState(window, true); // Remove one value at a time from the textboxes // Client OQ UIUtilities.TypeIntoTextbox(window.textbox_ClientOQ, ""); CheckAddPatientButtonState(window, false); UIUtilities.TypeIntoTextbox(window.textbox_ClientOQ, tempPatient.PatientOQ); // First Name UIUtilities.TypeIntoTextbox(window.textbox_FirstName, ""); CheckAddPatientButtonState(window, false); UIUtilities.TypeIntoTextbox(window.textbox_FirstName, tempPatient.PatientFirstName); // Last Name UIUtilities.TypeIntoTextbox(window.textbox_LastName, ""); CheckAddPatientButtonState(window, false); UIUtilities.TypeIntoTextbox(window.textbox_LastName, tempPatient.PatientLastName); // Relation UIUtilities.TypeIntoTextbox(window.textbox_RelationToHead, ""); CheckAddPatientButtonState(window, false); UIUtilities.TypeIntoTextbox(window.textbox_RelationToHead, tempPatient.RelationToHead); // Family OQ UIUtilities.TypeIntoTextbox(window.textbox_FamilyMemberOQ, ""); CheckAddPatientButtonState(window, false); UIUtilities.TypeIntoTextbox(window.textbox_FamilyMemberOQ, "1234560"); // Clear Head of House, then Check the checkbox UIUtilities.TypeIntoTextbox(window.textbox_RelationToHead, ""); UIUtilities.ClickOnItem(window.check_HeadOfHousehold); CheckAddPatientButtonState(window, true); // Clear family relation, then Check the checkbox UIUtilities.TypeIntoTextbox(window.textbox_FamilyMemberOQ, ""); UIUtilities.ClickOnItem(window.check_FirstHouseholdMember); CheckAddPatientButtonState(window, true); // With the new household selected, test the textbox UIUtilities.TypeIntoTextbox(window.textbox_HouseholdPopulation, ""); CheckAddPatientButtonState(window, false); UIUtilities.CloseWindow(window); }
public void TestAddingPatient() { // Set the testing data Patient tempPatient = new Patient(); tempPatient.PatientOQ = "123451"; tempPatient.PatientFirstName = "Test"; tempPatient.PatientLastName = "McGee"; tempPatient.RelationToHead = "Related"; tempPatient.PatientGender = "Female"; tempPatient.PatientEthnicity = "Pacific Islander"; tempPatient.PatientAgeGroup = "12-17"; tempPatient.IsHead = false; // TODO: Need to check the patient problems Test_Patient tpat = OpenTestPatient(); DeletePatient(tpat, tempPatient.PatientOQ); Window_Client window = OpenCreateNewPatient(); UIUtilities.ClickOnItem(window.check_FirstHouseholdMember); // Input the data for the comboboxes UIUtilities.TypeIntoTextbox(window.textbox_ClientOQ, tempPatient.PatientOQ); UIUtilities.TypeIntoTextbox(window.textbox_FirstName, tempPatient.PatientFirstName); UIUtilities.TypeIntoTextbox(window.textbox_LastName, tempPatient.PatientLastName); UIUtilities.TypeIntoTextbox(window.textbox_RelationToHead, tempPatient.RelationToHead); UIUtilities.SelectComboboxItem(window.combobox_AgeGroup, tempPatient.PatientAgeGroup); UIUtilities.SelectComboboxItem(window.combobox_ethnicity, tempPatient.PatientEthnicity); UIUtilities.SelectComboboxItem(window.combobox_Gender, tempPatient.PatientGender); UIUtilities.ClickOnItemNoWait(window.button_AddUpdateClient); // Find the added patient FindPatient(tpat, tempPatient.PatientOQ); // Add new test patient Patient newPatient = new Patient(); ThreadUtilities.RunOnUIThread(new Action(() => { newPatient.PatientOQ = tpat.text_PatientOQ.Text; newPatient.PatientLastName = tpat.text_LastName.Text; newPatient.PatientFirstName = tpat.text_FirstName.Text; newPatient.RelationToHead = tpat.text_RelationToHEad.Text; newPatient.PatientEthnicity = tpat.text_Ethnicity.Text; newPatient.PatientAgeGroup = tpat.text_AgeGroup.Text; newPatient.PatientGender = tpat.text_Gender.Text; })); ThreadUtilities.RunOnUIThread(new Action(() => { Assert.AreEqual(tempPatient.PatientOQ, newPatient.PatientOQ); Assert.AreEqual(tempPatient.PatientFirstName, newPatient.PatientFirstName); Assert.AreEqual(tempPatient.PatientLastName, newPatient.PatientLastName); Assert.AreEqual(tempPatient.RelationToHead, newPatient.RelationToHead); Assert.AreEqual(tempPatient.IsHead, newPatient.IsHead); Assert.AreEqual(tempPatient.PatientEthnicity, newPatient.PatientEthnicity); Assert.AreEqual(tempPatient.PatientAgeGroup, newPatient.PatientAgeGroup); Assert.AreEqual(tempPatient.PatientGender, newPatient.PatientGender); })); DeletePatient(tpat, tempPatient.PatientOQ); UIUtilities.CloseWindow(tpat); }