Пример #1
0
        public void GetAll_returns_data()
        {
            specializationRepository.GetAll().Returns(this.GetListOfSpecializations());

            List <IdentifiableDTO <SpecializationDTO> > returnedList = specializationService.GetAll().ToList();

            Assert.Equal(returnedList[0].Id, Guid.Parse("11ac21e1-1361-4c06-9751-9666ce10d30a"));
            Assert.Equal("Hirurg", returnedList[0].EntityDTO.Name);
            Assert.Equal(returnedList[1].Id, Guid.Parse("c389f917-3eb8-4f1a-a22c-bbc34b137f69"));
            Assert.Equal("Oftamolog", returnedList[1].EntityDTO.Name);
        }
        public InstructorDetailsDTO Get(int id)
        {
            Instructor           Instructor   = IInstructorRepository.Get(id);
            InstructorDetailsDTO MyInstructor = new InstructorDetailsDTO()
            {
                LastName  = Instructor.LastName,
                FirstName = Instructor.FirstName
            };

            IEnumerable <InstructorSpecialization> MyInstructorSpecializations = IInstructorSpecializationRepository.GetAll().Where(x => x.InstructorId == Instructor.Id);

            if (MyInstructorSpecializations != null)
            {
                List <string> SpecializationNameList = new List <string>();
                foreach (InstructorSpecialization MyInstructorSpecialization in MyInstructorSpecializations)
                {
                    Specialization MySpecialization = ISpecializationRepository.GetAll().SingleOrDefault(x => x.Id == MyInstructorSpecialization.SpecializationId);
                    SpecializationNameList.Add(MySpecialization.Name);
                }
                MyInstructor.SpecializationName = SpecializationNameList;
            }
            return(MyInstructor);
        }
Пример #3
0
 public List <Specialization> GetAll()
 {
     return(_specializationRepository.GetAll());
 }
Пример #4
0
 public IEnumerable <Master_Specialization> GetAll(Master_Specialization obj, string[] param, string spName)
 {
     return(_ISpecializationRepository.GetAll(obj, param, spName));
 }
 public IEnumerable <IdentifiableDTO <SpecializationDTO> > GetAll()
 {
     try
     {
         return(SpecializationMapper.MapSpecializationEntityCollectionToSpecializationIdentifierDTOCollection(_specializationRepository.GetAll()));
     }
     catch (ArgumentNullException)
     {
         throw new NotFoundEntityException();
     }
     catch (Exception)
     {
         throw new InternalServerErrorException();
     }
 }