public void ResultSaveTest() { string symptoms = GenString(_r.Next(9, 15)); string diagnosis = GenString(_r.Next(9, 15)); string medication = GenString(_r.Next(9, 15)); OpenConnection(); Results res = new Results(appointmentService.FindAll()[0].Id, DateTime.Now, symptoms, diagnosis, medication); Assert.IsInstanceOfType(resultService.Save(res), typeof(int)); CloseConnection(); }
/// <summary> /// Assigns a result to an appointment /// </summary> private void button_Click(object sender, RoutedEventArgs e) { String symptoms = textBoxSymptoms.Text; String medication = textBoxMedication.Text; String diagnosis = textBoxDiagnosis.Text; if (String.IsNullOrEmpty(symptoms) || String.IsNullOrEmpty(medication) || String.IsNullOrEmpty(diagnosis)) { MessageBox.Show("Inputs not valid !"); } else { try { _resultsService.Save(new Results(_selectedAppointment.Id, DateTime.Now, symptoms, diagnosis, medication)); MessageBox.Show("Result successfully asigned !"); RaiseChangePageContentEvent(new DoctorAppointmentsPage()); } catch (Exception ee) { MessageBox.Show("Something went wrong !\n" + ee.Data.ToString()); } } }