public void Delete_Appointment_removes_an_appointment_from_repository() { var appointment = MakeAppointment(); var repository = new InMemoryAppointmentRepository(); repository.Create(appointment); var controller = GetAppointmentsController(repository); controller.Delete(appointment.Id); Assert.That(repository.FindAll(), !Contains.Item(appointment)); }
public void Create_Appointment_creates_an_appointment_when_the_model_is_valid() { var repository = new InMemoryAppointmentRepository(); var controller = GetAppointmentsController(repository); var appointment = MakeAppointment(); controller.Create(appointment); var appointments = repository.FindAll(); Assert.That(appointments, Contains.Item(appointment)); }
public void Index_returns_a_list_of_the_existing_appointments() { var repository = new InMemoryAppointmentRepository(); repository.Create(MakeAppointment(1, "John")); repository.Create(MakeAppointment(2, "Jane")); var controller = GetAppointmentsController(repository); var result = controller.Index() as ViewResult; Assert.That(result.ViewData.Model, Is.EqualTo(repository.FindAll())); }