public void GetAll_Test() { // Arrange TestKolgraphEntities context = new TestKolgraphEntities(); var repository = new AppointmentEmployeeRepository(context); var service = new AppointmentEmployeeService(repository); // Act IEnumerable <AppointmentEmployeeModel> result = service.GetAll(); // Assert Assert.IsNotNull(result); Assert.AreEqual(context.appointment_employee.Count(), result.Count()); }
public void GetById_Test() { // Arrange TestKolgraphEntities context = new TestKolgraphEntities(); var repository = new AppointmentEmployeeRepository(context); var service = new AppointmentEmployeeService(repository); int id = 1; // Act AppointmentEmployeeModel 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 AppointmentEmployeeService(); AppointmentEmployeeModel model = GetTestModel(); // Act appointment_employee entity = service.ConvertModelToEntity(model); // Assert Assert.IsNotNull(entity); Assert.AreEqual(model.Id, entity.id); Assert.AreEqual(model.AppointmentId, entity.appointmentId); Assert.AreEqual(model.Employee.Id, entity.employeeId); }
public void ConvertEntityToModel_Test() { // Arrange TestKolgraphEntities context = new TestKolgraphEntities(); //var repository = new AppointmentEmployeeRepository(context); var service = new AppointmentEmployeeService(); appointment_employee entity = context.appointment_employee.Where(x => x.id == 1).FirstOrDefault(); // Act AppointmentEmployeeModel model = service.ConvertEntityToModel(entity); // Assert Assert.IsNotNull(model); Assert.AreEqual(model.Id, entity.id); Assert.AreEqual(model.AppointmentId, entity.appointmentId); Assert.AreEqual(model.Employee.Id, entity.employeeId); }
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()); }