public void Create_Appointment_Is_Called_Exactly_Once()
        {
            Mock <IAppointmentContext> mockContext = new Mock <IAppointmentContext>();
            Appointment appointment = new Mock <Appointment>(1, 3, 2, DateTime.Today, DateTime.Today, "Test").Object;

            mockContext.Setup(x => x.CreateAppointment(appointment));

            AppointmentLogic appointmentLogic = new AppointmentLogic(mockContext.Object);

            appointmentLogic.CreateAppointment(appointment);
            mockContext.Verify(x => x.CreateAppointment(appointment), Times.Exactly(1));
        }
        private void btMakeAppointment_Click(object sender, EventArgs e)
        {
            DateTime appointmentDateTime = dtpAppointment.Value;

            Appointment appointment = new Appointment(_questionID, _careRecipientID, _volunteerID, appointmentDateTime);

            AppointmentLogic AL = new AppointmentLogic();

            AL.CreateAppointment(appointment);

            MessageBox.Show("Afspraak gemaakt.");
            ((MainForm)this.Parent.Parent).ReplaceForm(new FormVolunteerChatOverview());
        }
Example #3
0
 public ActionResult CreateAppointment(AppointmentViewModel appointmentView)
 {
     try
     {
         _appointmentLogic.CreateAppointment(new Appointment(appointmentView.QuestionId, appointmentView.CareRecipientId, appointmentView.VolunteerId, DateTime.Now, appointmentView.TimeStamp, appointmentView.Location));
     }
     catch (ArgumentException e)
     {
         ViewBag.Message = "Datum mag niet in het verleden";
         return(View("Appointment/CreateAppointment"));
     }
     return(RedirectToAction("ChatOverview"));
 }
 public ActionResult CreateAppointment(AppointmentViewModel appointmentView)
 {
     _appointmentLogic.CreateAppointment(new Appointment(appointmentView.QuestionId, appointmentView.CareRecipientId, appointmentView.VolunteerId, DateTime.Now, appointmentView.TimeStamp, appointmentView.Location));
     return(RedirectToAction("ChatOverview"));
 }