Esempio n. 1
0
        public async Task SpecialtyExistTest()
        {
            var fakeRepository   = Mock.Of <ISpecialtyRepository>();
            var specialtyService = new SpecialtyService(fakeRepository);

            var specialty = new Specialty()
            {
                Id = 100, Name = "test"
            };

            await specialtyService.CreateSpecialty(specialty);

            Assert.True(!specialtyService.SpecialtyExist(specialty.Id));
        }
Esempio n. 2
0
        private void AddServices(IServiceCollection services)
        {
            var cityRepository = new CitySqlRepository(GetContextFactory());
            var cityService    = new CityService(cityRepository);

            services.Add(new ServiceDescriptor(typeof(CityService), cityService));

            var countryRepository = new CountrySqlRepository(GetContextFactory());
            var countryService    = new CountryService(countryRepository);

            services.Add(new ServiceDescriptor(typeof(CountryService), countryService));

            var doctorRepositry = new DoctorSqlRepository(GetContextFactory());
            var doctorService   = new DoctorService(doctorRepositry);

            services.Add(new ServiceDescriptor(typeof(DoctorService), doctorService));

            var patientRepository        = new PatientSqlRepository(GetContextFactory());
            var patientAccountRepository = new PatientAccountSqlRepository(GetContextFactory());
            var registrationNotifier     = new RegistrationNotifier(
                "http://" +
                Environment.GetEnvironmentVariable("PSW_API_GATEWAY_HOST") +
                ":" +
                Environment.GetEnvironmentVariable("PSW_API_GATEWAY_PORT") +
                "/api/patient/activate/");

            var patientAccountService      = new PatientAccountService(patientAccountRepository);
            var patientRegistrationService = new PatientRegistrationService(patientAccountService, registrationNotifier);

            var patientService = new PatientService(patientRepository, patientAccountRepository);

            var specialtyRepository = new SpecialtySqlRepository(GetContextFactory());
            var specialtyService    = new SpecialtyService(specialtyRepository);

            // Auth
            var userAccountRepository = new UserAccountSqlRepository(GetContextFactory());
            var credentialService     = new CredentialsService(userAccountRepository, GetJwtSecretFromEnvironment());

            // Advertisement
            var advertisementRepository = new AdvertisementSqlRepository(GetContextFactory());
            var advertisementService    = new AdvertisementService(advertisementRepository);

            services.Add(new ServiceDescriptor(typeof(CredentialsService), credentialService));
            services.Add(new ServiceDescriptor(typeof(IPatientAccountService), patientAccountService));
            services.Add(new ServiceDescriptor(typeof(IPatientRegistrationService), patientRegistrationService));
            services.Add(new ServiceDescriptor(typeof(PatientService), patientService));
            services.Add(new ServiceDescriptor(typeof(SpecialtyService), specialtyService));
            services.Add(new ServiceDescriptor(typeof(AdvertisementService), advertisementService));
        }
 public AddPhysicianView(PhysicianListViewModel physicianListViewModel,
                         PhysicianService physicianService,
                         PhysicianSpecialtyService physicianSpecialtyService,
                         SpecialtyService specialtyService,
                         FacilityService facilityService,
                         FacilityPhysicianService facilityPhysicianService)
 {
     InitializeComponent();
     _toAddPhysician = new AddPhysicianViewModel(physicianListViewModel,
                                                 physicianService,
                                                 facilityService,
                                                 specialtyService,
                                                 physicianSpecialtyService,
                                                 facilityPhysicianService);
     DataContext = _toAddPhysician;
 }
 public AddVolunteerView(VolunteerListViewModel volunteerListViewModel,
                         VolunteerService volunteerService,
                         PersonService personService,
                         WorkUnitService workUnitService,
                         SpecialtyService specialtyService,
                         VolunteerSpecialtyService volunteerSpecialtyService)
 {
     _toAddVolunteer = new AddVolunteerViewModel(volunteerListViewModel,
                                                 volunteerService,
                                                 personService,
                                                 workUnitService,
                                                 specialtyService,
                                                 volunteerSpecialtyService);
     DataContext = _toAddVolunteer;
     InitializeComponent();
 }
Esempio n. 5
0
        public async Task DeleteSpecialtyTest()
        {
            var fakeRepository   = Mock.Of <ISpecialtyRepository>();
            var specialtyService = new SpecialtyService(fakeRepository);

            var specialty = new Specialty()
            {
                Id = 1, Name = "test"
            };

            await specialtyService.CreateSpecialty(specialty);

            await specialtyService.DeleteSpecialty(specialty);

            Assert.Null(await specialtyService.GetSpecialty(1));
        }
Esempio n. 6
0
        public async Task EditSpecialtyTest()
        {
            var fakeRepository   = Mock.Of <ISpecialtyRepository>();
            var specialtyService = new SpecialtyService(fakeRepository);

            var specialty = new Specialty()
            {
                Name = "old name"
            };

            await specialtyService.CreateSpecialty(specialty);

            specialty.Name = "name updated";
            await specialtyService.EditSpecialty(specialty);

            Assert.Equal("name updated", specialty.Name);
        }
Esempio n. 7
0
        public async Task GetSpecialtyTest()
        {
            var specialty = new Specialty()
            {
                Id = 1, Name = "test specialty"
            };

            var fakeRepositoryMock = new Mock <ISpecialtyRepository>();

            fakeRepositoryMock.Setup(x => x.GetOne(It.IsAny <long?>())).ReturnsAsync(specialty);

            var specialtyService = new SpecialtyService(fakeRepositoryMock.Object);

            var resultSpecialty = await specialtyService.GetSpecialty(1);

            Assert.Equal("test specialty", resultSpecialty.Name);
        }
        public AddPhysicianViewModel(PhysicianListViewModel physicianListViewModel,
                                     PhysicianService physicianService,
                                     FacilityService facilityService,
                                     SpecialtyService specialtyService,
                                     PhysicianSpecialtyService physicianSpecialtyService,
                                     FacilityPhysicianService facilityPhysicianService)
        {
            _physicianListViewModel    = physicianListViewModel;
            _physicianService          = physicianService;
            _facilityService           = facilityService;
            _specialtyService          = specialtyService;
            _physicianSpecialtyService = physicianSpecialtyService;
            _facilityPhysicianService  = facilityPhysicianService;

            Specialties         = new ObservableCollection <Specialty>(_specialtyService.GetSpecialties());
            Facilities          = new ObservableCollection <Facility>(_facilityService.GetFacilities());
            SelectedSpecialties = new ObservableCollection <Specialty>();
            SelectedFacilities  = new ObservableCollection <Facility>();
        }
 public AddTechnicianView(TechnicianListViewModel technicianListViewModel,
                          EmployeeService employeeService,
                          WardService wardService,
                          WorkUnitService workUnitService,
                          SpecialtyService specialtyService,
                          EmployeeSpecialtyService employeeSpecialtyService,
                          WardEmployeeService wardEmployeeService,
                          UnitEmployeeService unitEmployeeService)
 {
     _toAddTechnician = new AddTechnicianViewModel(technicianListViewModel,
                                                   employeeService,
                                                   wardService,
                                                   workUnitService,
                                                   specialtyService,
                                                   employeeSpecialtyService,
                                                   wardEmployeeService,
                                                   unitEmployeeService);
     DataContext = _toAddTechnician;
     InitializeComponent();
 }
Esempio n. 10
0
        public DoctorModel()
        {
            _doctorService    = new DoctorService();
            _chamberService   = new ChamberService();
            _degreeService    = new DegreeService();
            _specialtyService = new SpecialtyService();

            SpecialtyCollection = _specialtyService.GetAll();
            DegreeCollection    = _degreeService.GetAll();
            ChamberCollection   = _chamberService.GetAll();

            GenderCollection = new List <Gender>()
            {
                new Gender()
                {
                    Id = 1, Name = "Male"
                },
                new Gender()
                {
                    Id = 2, Name = "Female"
                }, new Gender()
                {
                    Id = 3, Name = "Others"
                }
            };

            BloodGroupCollection = new List <BloodGroup>()
            {
                new BloodGroup()
                {
                    Id = 1, Name = "A+"
                },
                new BloodGroup()
                {
                    Id = 2, Name = "A-"
                }, new BloodGroup()
                {
                    Id = 3, Name = "AB+"
                }
            };
        }
Esempio n. 11
0
 public AddTechnicianViewModel(TechnicianListViewModel technicianListViewModel,
                               EmployeeService employeeService,
                               WardService wardService,
                               WorkUnitService workUnitService,
                               SpecialtyService specialtyService,
                               EmployeeSpecialtyService employeeSpecialtyService,
                               WardEmployeeService wardEmployeeService,
                               UnitEmployeeService unitEmployeeService)
 {
     _technicianListViewModel  = technicianListViewModel;
     _employeeService          = employeeService;
     _wardService              = wardService;
     _workUnitService          = workUnitService;
     _employeeSpecialtyService = employeeSpecialtyService;
     _specialtyService         = specialtyService;
     _wardEmployeeService      = wardEmployeeService;
     _unitEmployeeService      = unitEmployeeService;
     Specialties = new ObservableCollection <Specialty>(_specialtyService.GetSpecialties());
     Wards       = new ObservableCollection <Ward>(_wardService.GetWards());
     WorkUnits   = new ObservableCollection <WorkUnit>(_workUnitService.GetWorkUnits());
 }
        public async Task SaveAsyncWhenSaveReturnsSaved()
        {
            //Assert
            var       mockSpecialtyRepository           = GetDefaultISpecialtyRepositoryInstance();
            var       mockVeterinarySpecialtyRepository = GetDefaultIVeterinarySpecialtyRepositoryInstance();
            var       mockUnitOfWork = GetDefaultIUnitOfWorkInstance();
            Specialty specialty      = new Specialty {
                Id = 10, Name = "Baños"
            };

            mockSpecialtyRepository.Setup(r => r.AddAsync(specialty))
            .Returns(Task.FromResult <Specialty>(specialty));

            var service = new SpecialtyService(mockSpecialtyRepository.Object, mockVeterinarySpecialtyRepository.Object, mockUnitOfWork.Object);

            //Act
            SpecialtyResponse result = await service.SaveAsync(specialty);

            //Assert
            result.Resource.Should().Be(specialty);
        }
        public async Task GetByIdAsyncWhenNoSpecialtyFoundReturnsSpecialtyNotFoundResponse()
        {
            //Assert
            var mockSpecialtyRepository           = GetDefaultISpecialtyRepositoryInstance();
            var mockVeterinarySpecialtyRepository = GetDefaultIVeterinarySpecialtyRepositoryInstance();
            var mockUnitOfWork = GetDefaultIUnitOfWorkInstance();
            int specialtyId    = 1;

            mockSpecialtyRepository.Setup(r => r.FindById(specialtyId))
            .Returns(Task.FromResult <Specialty>(null));

            var service = new SpecialtyService(mockSpecialtyRepository.Object, mockVeterinarySpecialtyRepository.Object, mockUnitOfWork.Object);

            //Act
            SpecialtyResponse result = await service.GetByIdAsync(specialtyId);

            var message = result.Message;

            //Assert
            message.Should().Be("Specialty not found");
        }
 public AddStaffView(StaffListViewModel staffListViewModel,
                     EmployeeService employeeService,
                     WardService wardService,
                     WorkUnitService workUnitService,
                     SpecialtyService specialtyService,
                     JobClassService jobClassService,
                     EmployeeSpecialtyService employeeSpecialtyService,
                     WardEmployeeService wardEmployeeService,
                     UnitEmployeeService unitEmployeeService)
 {
     _toAddStaff = new AddStaffViewModel(staffListViewModel,
                                         employeeService,
                                         wardService,
                                         workUnitService,
                                         specialtyService,
                                         jobClassService,
                                         employeeSpecialtyService,
                                         wardEmployeeService,
                                         unitEmployeeService);
     DataContext = _toAddStaff;
     InitializeComponent();
 }
        public AddNurseView(NurseListViewModel nurseListViewModel,
                            EmployeeService employeeService,
                            WardService wardService,
                            WorkUnitService workUnitService,
                            SpecialtyService specialtyService,
                            EmployeeSpecialtyService employeeSpecialtyService,
                            WardEmployeeService wardEmployeeService,
                            UnitEmployeeService unitEmployeeService)
        {
            _toAddNurse = new AddNurseViewModel(nurseListViewModel,
                                                employeeService,
                                                wardService,
                                                workUnitService,
                                                specialtyService,
                                                employeeSpecialtyService,
                                                wardEmployeeService,
                                                unitEmployeeService);
            DataContext = _toAddNurse;
            InitializeComponent();

            //default
            RnSelectButton.IsChecked = true;
        }
 public GroupsPrintConsoleService(GroupService groupService, SpecialtyService specialtyService)
 {
     _groupService     = groupService;
     _specialtyService = specialtyService;
 }
 public SpecialtyController(SpecialtyService specialtyService, ISpecialtyRepository specialtyRepository)
 {
     SpecialtyService    = specialtyService;
     SpecialtyRepository = specialtyRepository;
 }
 public SpecialtyController(SpecialtyService specialtyService)
 {
     this.specialtyService = specialtyService;
 }
Esempio n. 19
0
 public SpecialtiesPrintConsoleService(SpecialtyService specialtyService)
 {
     _specialtyService = specialtyService;
 }
Esempio n. 20
0
 public SpecialtiesCrudConsoleService(SpecialtyService specialtyService)
 {
     _specialtyService = specialtyService;
 }
Esempio n. 21
0
 public AutoCompleteController()
 {
     _doctorService    = new DoctorService();
     _specialtyService = new SpecialtyService();
     _areaService      = new AreaService();
 }
Esempio n. 22
0
 public SpecialtyController(SpecialtyService specialtyService, CourseProjectContext context)
 {
     _specialtyService = specialtyService;
     _context          = context;
 }