예제 #1
0
        public void Map_doctor_entity_to_identifier_doctor_dto_when_when_entity_is_null()
        {
            Doctor doctor = null;

            Assert.Throws <ArgumentNullException>(()
                                                  => DoctorMapper.MapDoctorEntityToIdentifierDoctorDTO(doctor));
        }
예제 #2
0
        public void Map_doctor_entity_to_identifier_doctor_dto()
        {
            Doctor doctor = this.GetDoctorFirts();

            IdentifiableDTO <DoctorDTO> identifierDoctorDTO = DoctorMapper.MapDoctorEntityToIdentifierDoctorDTO(doctor);

            Assert.True(IsEqualDoctorEntitiesAndIdentifierDoctorDTO(doctor, identifierDoctorDTO));
        }
예제 #3
0
 public IdentifiableDTO <DoctorDTO> GetById(Guid id)
 {
     try
     {
         return(DoctorMapper.MapDoctorEntityToIdentifierDoctorDTO(_doctorRepository.GetById(id)));
     }catch (ArgumentNullException e)
     {
         throw new NotFoundEntityException();
     }catch (Exception e)
     {
         throw new InternalServerErrorException();
     }
 }
예제 #4
0
 public IEnumerable <IdentifiableDTO <DoctorDTO> > GetAll()
 {
     try
     {
         return(_doctorRepository.GetAll().Select(c => DoctorMapper.MapDoctorEntityToIdentifierDoctorDTO(c)));
     }
     catch (ArgumentNullException e)
     {
         throw new NotFoundEntityException();
     }
     catch (Exception e)
     {
         throw new InternalServerErrorException();
     }
 }