Beispiel #1
0
        public void Specialty_Service_Return_Specialty()
        {
            // Act
            var response = _specialtyService.GetSpecialty(new RequestDto(1));

            // Assert
            Assert.False(LocalNotification.HasNotification());
            Assert.True(response.Id == 1);
            Assert.True(response.Description == "Cirurgia Vascular");
        }
        public SpecialtyResponse Get(int id)
        {
            SpecialtyResponse response = new SpecialtyResponse()
            {
                Success = true
            };

            try
            {
                Specialty specialty = specialtyService.GetSpecialty(id);
                if (specialty == null)
                {
                    throw new RecordNotFoundException(string.Format("Specialty {0} not found", id));
                }

                response.Specialty = specialty;
            }
            catch (Exception exc)
            {
                response.Success      = false;
                response.ErrorCode    = ((int)ErrorResponse.ServerError).ToString();
                response.ErrorMessage = exc.Message;
            }

            return(response);
        }
Beispiel #3
0
        public SpecialtyDto GetSpecialty(RequestDto id)
        {
            if (id.GetId() <= 0)
            {
                RaiseNotification(nameof(id));
            }

            if (Notification.HasNotification())
            {
                return(new SpecialtyDto());
            }

            var entity = _service.GetSpecialty(id);

            return(entity.MapTo <SpecialtyDto>());
        }