private void RegisterPatient_Click(object sender, RoutedEventArgs e) { int?insuranceNumber; if (!UserInputControl.InsuranceNumToInt(TextInsuranceNumber.Text, out insuranceNumber)) { MessageBox.Show("TAJ-szám helytelen!"); return; } TextLastName.Text = TextLastName.Text.Trim(); if (!UserInputControl.CheckName(TextLastName.Text)) { MessageBox.Show("Vezetéknév hibásan lett kitöltve!"); return; } TextFirstName.Text = TextFirstName.Text.Trim(); if (!UserInputControl.CheckName(TextFirstName.Text)) { MessageBox.Show("Keresztnév hibásan lett kitöltve!"); return; } patient = new Patient { FirstName = TextFirstName.Text, LastName = TextLastName.Text, dateOfBirth = DatePickerBirth.SelectedDate, Address = TextAddress.Text, InsuranceNumber = insuranceNumber, ID = -1 }; var admission = new Admission { Symptomes = TextSymptoms.Text, TimeOfAdmission = DateTime.Now, Diagnosis = "", PatientID = -1 }; ViewModel data = new ViewModel { Patient = patient, Admission = admission }; var json = JsonConvert.SerializeObject(data); var stringContent = new StringContent(json, Encoding.UTF8, "application/json"); using (var HttpClient = new HttpClient()) { var result = HttpClient.PostAsync("http://localhost:8080/assistant/", stringContent); if (result.Result.IsSuccessStatusCode) { MessageBox.Show("Kész!\n"); TextSymptoms.Clear(); } else { MessageBox.Show("Hiba!\n" + result.Result); } } }
public void Name_Checked_correctly(string str, bool expected) { //Act bool actual = UserInputControl.CheckName(str); //Assert Assert.Equal(expected, actual); }
public void Convert_InsuranceNumber_Test(string input, int?result, bool output) { //Arrange //Act int? actualResult; bool actualOutput = UserInputControl.InsuranceNumToInt(input, out actualResult); //Assert Assert.Equal(result, actualResult); Assert.Equal(output, actualOutput); }
private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { Patient patient = (Patient)PatientsList.SelectedItem; this.patient = patient; if (patient is null) { TextFirstName.Clear(); TextLastName.Clear(); DatePickerBirth.SelectedDate = DateTime.Now; TextAddress.Clear(); TextInsuranceNumber.Clear(); } else { TextFirstName.Text = patient.FirstName; TextLastName.Text = patient.LastName; DatePickerBirth.SelectedDate = patient.dateOfBirth; TextAddress.Text = patient.Address; TextInsuranceNumber.Text = UserInputControl.InsuranceNumToString(patient.InsuranceNumber); } TextSymptoms.Clear(); }