public void CreateFailTest() { // Arrange IAppointmentRepository repository = new AppointmentRepository(); // Act Appointment result = repository.Create(null); }
public HomeController() { IList<Appointment> appointment = new List<Appointment> { new Appointment { ID = 1, Patient = new Patient { FirstName = "James", LastName = "Waudby" } } }; IAppointmentRepository repository = new AppointmentRepository(appointment); appointmentService = new AppointmentService(repository); }
public void GetByIDExceptionTest() { // Arrange IList<Appointment> appointments = new List<Appointment> { new Appointment() { ID = 1 } }; IAppointmentRepository repository = new AppointmentRepository(appointments); // Act Appointment result = repository.GetByID(2); }
public void CreateAppointmentWithInvalidRequestTest() { // Arrange IAppointmentRepository repository = new AppointmentRepository(); IAppointmentService service = new AppointmentService(repository); // Arrange CreateAppointmentRequest request = new CreateAppointmentRequest(); // Act AppointmentResponse result = service.CreateAppointment(request); // Assert Assert.IsNull(result.Appointment); Assert.IsFalse(result.Success); }
public void GetAllTest() { // Arrange IList<Appointment> appointments = new List<Appointment> { new Appointment { ID = 1 }, new Appointment { ID = 2 } }; IAppointmentRepository repository = new AppointmentRepository(appointments); // Act IList<Appointment> result = repository.GetAll().ToList(); // Assert Assert.AreEqual(1, result[0].ID); Assert.AreEqual(2, result[1].ID); }
public void CreateTest() { // Arrange IAppointmentRepository repository = new AppointmentRepository(); // Arrange Appointment appointment = new Appointment() { Patient = new Patient { FirstName = "Test", LastName = "Test" } }; // Act Appointment result = repository.Create(appointment); // Assert Assert.AreEqual(appointment, result); Assert.AreEqual(1, appointment.ID); }
public void GetAppointmentTest() { // Arrange IList<Appointment> appointments = new List<Appointment> { new Appointment() { ID = 1 } }; // Arrange IAppointmentRepository repository = new AppointmentRepository(appointments); IAppointmentService service = new AppointmentService(repository); // Arrange AppointmentRequest request = new AppointmentRequest() { AppointmentID = 1 }; // Act AppointmentResponse result = service.GetAppointment(request); // Assert Assert.AreEqual(appointments[0], result.Appointment); Assert.IsTrue(result.Success); }
public void CreateAppointmentTest() { // Arrange IAppointmentRepository repository = new AppointmentRepository(); IAppointmentService service = new AppointmentService(repository); // Arrange Appointment appointment = new Appointment() { Patient = new Patient { FirstName = "Test", LastName = "Test" } }; // Arrange CreateAppointmentRequest request = new CreateAppointmentRequest() { Appointment = appointment }; // Act AppointmentResponse result = service.CreateAppointment(request); // Assert Assert.AreEqual(appointment.ID, result.Appointment.ID); Assert.AreEqual(appointment.Patient, result.Appointment.Patient); Assert.IsTrue(result.Success); }
public void GetByIDTest() { // Arrange IList<Appointment> appointments = new List<Appointment> { new Appointment() { ID = 1 } }; IAppointmentRepository repository = new AppointmentRepository(appointments); // Act Appointment result = repository.GetByID(1); // Assert Assert.AreEqual(1, result.ID); }