private void Add_Button_Clicked(object sender, EventArgs e) { this.Hide(); Incidents.Add_Incident(_user_id, Description_Textbox.Text); // Repopulate the list, so the new description is can be seen _incidentsForm.Populate_User_Search_List(); }
public void Staff_should_search_resident_by_name() { // Add an incident before hand string theIncident = "Resident dropped item on their foot."; Incidents.Add_Incident("5", theIncident); // Test should only pass if the program returns the name of the resident the user was searching for Assert.IsTrue(Incidents.Get_Incidents_By_Name("resident")); // Delete the entry once done string[] columnNames = { "UID", "IncidentDescription" }; string[] columnExpectedValues = { "5", theIncident }; _mysql.Delete_Entries("5", "Incidents", columnNames, columnExpectedValues); }
public void Staff_should_add_incidents() { string theIncident = "Resident refused to take their medicine"; // Add the incident Incidents.Add_Incident("5", theIncident); // It should only pass if the incident now exists in the database string[] columnsToCheck = { "UID", "IncidentDescription" }; string[] columnValues = { "5", theIncident }; Assert.IsTrue(_mysql.DataDoesExist("Incidents", columnsToCheck, columnValues)); // Remove the test entry from the database _mysql.Delete_Entries("5", "Incidents", columnsToCheck, columnValues); }
public void Staff_should_update_incident_details() { // First add a sample incident to the database. string theIncident = "Resident refused to take their medicine"; // User ID is 5 Incidents.Add_Incident("5", theIncident); // Change the description string updatedDesc = "Resident refused to take their medicine, SuperDrug. They became aggressive" + " when confronted by staff"; // Update the entry Incidents.Update_Incident("5", theIncident, updatedDesc); string[] columnNames = { "UID", "IncidentDescription" }; string[] columnExpectedValues = { "5", updatedDesc }; // Test passes if the entry has changed Assert.IsTrue(_mysql.DataDoesExist("Incidents", columnNames, columnExpectedValues)); // Delete once done _mysql.Delete_Entries("5", "Incidents", columnNames, columnExpectedValues); }