public void GetAll_Test() { // Arrange TestKolgraphEntities context = new TestKolgraphEntities(); var repository = new AppointmentHitchayvutRepository(context); var hitchayvutService = new HitchayvutService(); var service = new AppointmentHitchayvutService(repository, hitchayvutService); // Act IEnumerable <AppointmentHitchayvutModel> result = service.GetAll(); // Assert Assert.IsNotNull(result); Assert.AreEqual(context.appointment_hitchayvut.Count(), result.Count()); }
public void GetById_Test() { // Arrange TestKolgraphEntities context = new TestKolgraphEntities(); var repository = new AppointmentHitchayvutRepository(context); var hitchayvutService = new HitchayvutService(); var service = new AppointmentHitchayvutService(repository, hitchayvutService); int id = 1; // Act AppointmentHitchayvutModel result = service.GetById(id); // Assert Assert.IsNotNull(result); Assert.AreEqual(id, result.Id); }
public void ConvertModelToEntity_Test() { // Arrange TestKolgraphEntities context = new TestKolgraphEntities(); var service = new AppointmentHitchayvutService(); AppointmentHitchayvutModel model = GetTestModel(); // Act appointment_hitchayvut entity = service.ConvertModelToEntity(model); // Assert Assert.IsNotNull(entity); Assert.AreEqual(model.Id, entity.id); Assert.AreEqual(model.AppointmentId, entity.appointmentId); Assert.AreEqual(model.Hitchayvut.Id, entity.hitchayvutId); }
public void GetAllFilterByBranch_Test() { // Arrange TestKolgraphEntities context = new TestKolgraphEntities(); var repository = new AppointmentRepository(context); var appointmentEmployeeService = new AppointmentEmployeeService(); var appointmentTestService = new AppointmentTestService(); var appointmentHitchayvutService = new AppointmentHitchayvutService(); var service = new AppointmentService(repository, appointmentEmployeeService, appointmentTestService, appointmentHitchayvutService); int branchId = 1; // Act IEnumerable <AppointmentModel> result = service.GetAllFilterByBranch(branchId); // Assert Assert.AreEqual(context.appointment.Where(x => x.branchId == branchId).Count(), result.Count()); }
public void GetAllFilterByPatient_Test() { // Arrange TestKolgraphEntities context = new TestKolgraphEntities(); var repository = new AppointmentRepository(context); var appointmentEmployeeService = new AppointmentEmployeeService(); var appointmentTestService = new AppointmentTestService(); var appointmentHitchayvutService = new AppointmentHitchayvutService(); var service = new AppointmentService(repository, appointmentEmployeeService, appointmentTestService, appointmentHitchayvutService); int patientId = 2; // Act IEnumerable <AppointmentModel> result = service.GetAllFilterByPatientId(patientId); // Assert Assert.AreEqual(context.appointment.Where(x => x.contactId == patientId && x.contactTypeId == (int)ObjectTypeEnum.Patient).Count(), result.Count()); Assert.AreEqual(result.Where(x => x.ContactId == patientId && x.ContactTypeId == (int)ObjectTypeEnum.Patient).Count(), result.Count()); }
public void GetAllFilterByDate_Test() { // Arrange TestKolgraphEntities context = new TestKolgraphEntities(); var repository = new AppointmentRepository(context); var appointmentEmployeeService = new AppointmentEmployeeService(); var appointmentTestService = new AppointmentTestService(); var appointmentHitchayvutService = new AppointmentHitchayvutService(); var service = new AppointmentService(repository, appointmentEmployeeService, appointmentTestService, appointmentHitchayvutService); int year = 2019; int month = 7; int day = 7; // Act IEnumerable <AppointmentModel> result = service.GetAllFilterByDate(year, month, day); // Assert Assert.AreEqual(context.appointment.Where(x => x.dateTime.Year == year && x.dateTime.Month == month && x.dateTime.Day == day).Count(), result.Count()); }
public void ConvertEntityToModel_Test() { // Arrange TestKolgraphEntities context = new TestKolgraphEntities(); var service = new AppointmentHitchayvutService(); appointment_hitchayvut entity = context.appointment_hitchayvut.Where(x => x.id == 1).FirstOrDefault(); // Act AppointmentHitchayvutModel model = service.ConvertEntityToModel(entity); // Assert Assert.IsNotNull(model); Assert.AreEqual(model.Id, entity.id); Assert.AreEqual(model.AppointmentId, entity.appointmentId); if (entity.hitchayvut == null) { Assert.AreEqual(model.Hitchayvut, null); } else { Assert.AreEqual(model.Hitchayvut.Id, entity.hitchayvutId); } }