public void AllergicTo_ReturnEggs_True() { AllergicTo testAllergicTo = new AllergicTo(); List <string> testAllergyList = new List <string>(); testAllergyList.Add("eggs"); List <string> inputAllergyList = testAllergicTo.CheckAllergicTo(1); CollectionAssert.AreEqual(testAllergyList, inputAllergyList); }
/******************************************************************************************** * Button Click that calls the insert function for allergies and adds new rows to the database * based upon the current patient. It then closes this form. * ******************************************************************************************/ private void updateAllergyButton_Click(object sender, EventArgs e) { if (AllergicTo.Text == "" || Reaction.Text == "") { MessageBox.Show("Something must be entered for each field. If patient is not applicable for a certain field enter 'N/A'.", "Attention", MessageBoxButtons.OK); return; } if (editing == false) { string insertedRows = InsertFunctions.InsertIntoAllergyInfo(PatientID, AllergicTo.Text, Reaction.Text); MessageBox.Show(insertedRows); AllergicTo.Clear(); Reaction.Clear(); } else if (editing == true) { UpdateFunctions.UpdateAllergyInfo(PatientID, AllergicTo.Text, Reaction.Text, editAllergicTo, editReaction); AllergicTo.Clear(); Reaction.Clear(); this.Close(); } }
public static void Main() { AllergicTo allergicTo = new AllergicTo(); Console.WriteLine("Enter an allergy score:"); string stringAllergyScore = Console.ReadLine(); int allergyScore = int.Parse(stringAllergyScore); if (allergyScore >= 256 || allergyScore < 0) { Console.WriteLine("That's not possible!"); } else { List <string> allergyList = allergicTo.CheckAllergicTo(allergyScore); foreach (string i in allergyList) { Console.WriteLine(i); } } }