// Used in the TestButtonDisable test private void CheckAddPatientButtonState(Window_Client window, bool isEnabled) { GeneralUtilities.WaitUntil(() => (bool)Application.Current.Dispatcher.Invoke(new Func <bool>(() => window.button_AddUpdateClient.IsLoaded))); ThreadUtilities.RunOnUIThread(new Action(() => { Assert.AreEqual(isEnabled, (bool)window.button_AddUpdateClient.IsEnabled); })); }
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 Open_CreateNewPatient(object sender, RoutedEventArgs e) { Window_Client ch = new Window_Client(StaffRole, null); ch.combobox_Gender.SelectedIndex = 0; ch.combobox_AgeGroup.SelectedIndex = 0; ch.combobox_ethnicity.SelectedIndex = 0; ch.ShowDialog(); // Refresh the grid after closing the create new patient Refresh_ClientGrid(sender, e); }
/// <summary> /// Opens CreateNewPatient dialog, then returns the object /// </summary> /// <returns></returns> private Window_Client OpenCreateNewPatient() { Window_Client window = null; ThreadUtilities.RunOnUIThread(new Action(() => { window = new Window_Client(Definition.Admin, null); window.Show(); window.Activate(); })); GeneralUtilities.WaitUntil(() => (bool)Application.Current.Dispatcher.Invoke(new Func <bool>(() => window.IsLoaded))); return(window); }
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); }
// ----------------------------------------------------------------------------- /// <summary> /// This method is for when the EditPatient button is clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EditPatient(object sender, RoutedEventArgs e) { try { DataGrid dg = sender as DataGrid; PatientGrid p = (PatientGrid)dg.SelectedItems[0]; // OR: Patient p = (Patient)dg.SelectedItem; Window_Client clientWindow = new Window_Client(StaffRole, p); clientWindow.ShowDialog(); } catch (Exception error) { } // Refresh the grid Refresh_ClientGrid(sender, e); }
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); }
public void TestUsingFamilyOQForHousehold() { // Premade Family Member Patient familyPatient = new Patient(); familyPatient.PatientOQ = "123450"; familyPatient.PatientFirstName = "Doodly"; familyPatient.PatientLastName = "Doo"; familyPatient.RelationToHead = "DA FATHER"; familyPatient.PatientGender = "Male"; familyPatient.PatientEthnicity = "Caucasian"; familyPatient.PatientAgeGroup = "24-44"; familyPatient.IsHead = true; // Premade household PatientHousehold familyHousehold = new PatientHousehold(); familyHousehold.HouseholdCounty = "Box Elder"; familyHousehold.HouseholdIncomeBracket = "$25,000-34,999"; familyHousehold.HouseholdPopulation = 7; // 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 patient Test_Patient tpat = OpenTestPatient(); DeletePatient(tpat, tempPatient.PatientOQ); DeletePatient(tpat, familyPatient.PatientOQ); AddPatient(tpat, familyPatient, familyHousehold); // Add the temp patient manually, but link to previously-made family member Window_Client window = OpenCreateNewPatient(); UIUtilities.TypeIntoTextbox(window.textbox_FamilyMemberOQ, familyPatient.PatientOQ); 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); ThreadUtilities.RunOnUIThread(new Action(() => { Assert.AreEqual(familyHousehold.HouseholdCounty, tpat.text_county.Text); Assert.AreEqual(familyHousehold.HouseholdIncomeBracket, tpat.text_Income.Text); Assert.AreEqual(familyHousehold.HouseholdPopulation, int.Parse(tpat.text_HouseholdPop.Text)); })); // Clean up DeletePatient(tpat, tempPatient.PatientOQ); DeleteHousehold(tpat, familyPatient.PatientOQ); DeletePatient(tpat, familyPatient.PatientOQ); }