private void BtnRemoveAppointment_Click(object sender, EventArgs e) { if (LvAppointments.FocusedItem.Index != -1) { visitorLogic.RemoveAppointment(LvAppointments.FocusedItem.SubItems[0].Text, LvAppointments.FocusedItem.SubItems[1].Text, DateTime.Parse(LvAppointments.FocusedItem.SubItems[2].Text)); UpdateAppointmentList(); AppointmentsToday(); } }
public void RemoveAppointment() { database.Appointments.Clear(); Appointment appointment = new Appointment() { Name = "TestAppointment", Visitor = "TestVisitor", Date = DateTime.Today }; visitorLogic.AddAppointment(appointment.Name, appointment.Visitor, appointment.Date); if (database.Appointments.Find(x => x.Name == appointment.Name && x.Visitor == appointment.Visitor && x.Date == appointment.Date) == null) { Assert.Fail(); } visitorLogic.RemoveAppointment(appointment.Name, appointment.Visitor, appointment.Date); Console.WriteLine(database.Appointments.Find(x => x.Name == appointment.Name && x.Visitor == appointment.Visitor && x.Date == appointment.Date)); Assert.IsTrue(database.Appointments.Find(x => x.Name == appointment.Name && x.Visitor == appointment.Visitor && x.Date == appointment.Date) == null); }