public void TestAppointmentsMonths() { var month = 1; //february var february_appointments = CalendarServicePoint.GetAllAppointmentsByMonth(month); Assert.AreEqual(0, february_appointments.Count(x => x.AppointmentDate.Month != February)); }
public void ProcessRequest(HttpContext context) { CalendarServicePoint.DataLoad(); context.Response.ContentType = "application/json"; var req = context.Request.RawUrl.Split(new char[] { '/' }); if (req.Length > 2) { switch (req[2]) { case Paths.Appointments: { if (CalendarServiceRequestValidation.AppointmentsRequestIsValid(req)) { var appointments = CalendarServicePoint.GetAllAppointmentsByMonth(Convert.ToInt32(req[3])); context.Response.Write(JsonConvert.SerializeObject(appointments)); } else { WriteErrorToRequest(context); } break; } case Paths.AppointmentDetail: { if (CalendarServiceRequestValidation.AppointmentDetailRequestIsValid(req)) { var appointment = CalendarServicePoint.GetAppointmentDetailById(Convert.ToInt32(req[3])); context.Response.Write(JsonConvert.SerializeObject(appointment)); } else { WriteErrorToRequest(context); } break; } default: { WriteErrorToRequest(context); break; } } } }