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); }
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 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); }