public void CreateUpdateSaveDeleteAppointmentTest()
        {
            int      customerId  = 1;
            int      userId      = 0;
            string   title       = "Test Appointment";
            string   description = "Test Descriptiton";
            string   location    = "Test Location";
            string   contact     = "Test contact";
            string   type        = "Test Type";
            string   url         = "Test.url.com";
            DateTime start       = DateTime.UtcNow;
            DateTime end         = DateTime.UtcNow;

            end.AddDays(1);
            DateTime createdDate  = DateTime.Now;
            string   createdBy    = "system";
            DateTime modifiedDate = DateTime.Now;
            string   modifiedBy   = "system";

            Appointment appt = AppointmentDao.CreateNewAppointment(customerId,
                                                                   userId,
                                                                   title,
                                                                   description,
                                                                   location,
                                                                   contact,
                                                                   type,
                                                                   url,
                                                                   start,
                                                                   end,
                                                                   createdDate,
                                                                   createdBy,
                                                                   modifiedDate,
                                                                   modifiedBy);

            Assert.IsInstanceOfType(appt, typeof(Appointment));
            Assert.IsTrue(appt.Title == title);
            Assert.IsTrue(appt.CreateDate == createdDate);

            bool saved = AppointmentDao.SaveAppointment(appt);

            Assert.IsTrue(saved == true);

            appt.Title = "Updated Test Title";
            bool update = AppointmentDao.UpdateAppointment(appt);

            Assert.IsTrue(update == true);

            bool delete = AppointmentDao.DeleteAppointment(appt);

            Assert.IsTrue(delete == true);
        }
Exemple #2
0
        private void DeleteApptButton_Click(object sender, EventArgs e)
        {
            int  appointmentId = Convert.ToInt32(AppointmentsComboBox.SelectedValue);
            var  appt          = AppointmentDao.GetAppointmentById(appointmentId);
            bool deleted       = AppointmentDao.DeleteAppointment(appt);

            if (deleted == true)
            {
                MessageBox.Show("Deleted appointment successfully.");
                SetDefaults();
            }
            else
            {
                MessageBox.Show("Appointment wasn't able to be deleted.");
            }
        }