public void ConvertModelToEntity_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var service = new AppointmentTestService();
            AppointmentTestModel model = GetTestModel();

            // Act
            appointment_test entity = service.ConvertModelToEntity(model);

            // Assert
            Assert.IsNotNull(entity);
            Assert.AreEqual(model.AppointmentId, entity.appointmentId);
            Assert.AreEqual(model.Test.Id, entity.testId);
        }
        public void GetAll_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository                 = new AppointmentTestRepository(context);
            var hitchayvutService          = new HitchayvutService();
            var testResultValueTextService = new TestResultValueTextService();
            var service = new AppointmentTestService(repository, hitchayvutService, testResultValueTextService);

            // Act
            IEnumerable <AppointmentTestModel> result = service.GetAll();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(context.appointment_test.Count(), result.Count());
        }
        public void GetAllFilterByAppointment_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository                 = new AppointmentTestRepository(context);
            var hitchayvutService          = new HitchayvutService();
            var testResultValueTextService = new TestResultValueTextService();
            var service       = new AppointmentTestService(repository, hitchayvutService, testResultValueTextService);
            int appointmentId = 1;

            // Act
            IEnumerable <AppointmentTestModel> result = service.GetAllFilterByAppointmentId(appointmentId);

            // Assert
            Assert.AreEqual(context.appointment_test.Where(x => x.appointmentId == appointmentId).Count(), result.Count());
            Assert.AreEqual(result.Where(x => x.AppointmentId == appointmentId).Count(), result.Count());
        }
        public void GetById_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository                 = new AppointmentTestRepository(context);
            var hitchayvutService          = new HitchayvutService();
            var testResultValueTextService = new TestResultValueTextService();
            var service = new AppointmentTestService(repository, hitchayvutService, testResultValueTextService);
            int id      = 1;

            // Act
            AppointmentTestModel result = service.GetById(id);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(id, result.Id);
        }
示例#5
0
        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());
        }
示例#6
0
        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());
        }
示例#7
0
        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 AppointmentTestService();
            appointment_test entity = context.appointment_test.Where(x => x.id == 1).FirstOrDefault();

            // Act
            AppointmentTestModel model = service.ConvertEntityToModel(entity);

            // Assert
            Assert.IsNotNull(model);
            Assert.AreEqual(model.Id, entity.id);
            Assert.AreEqual(model.AppointmentId, entity.appointmentId);
            if (entity.test == null)
            {
                Assert.AreEqual(model.Test, null);
            }
            else
            {
                Assert.AreEqual(model.Test.Id, entity.testId);
            }
        }