예제 #1
0
 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();
     }
 }
예제 #2
0
        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);
        }