Example #1
0
        public void CreatePatientDocument_GivenValidArguments_EntityIsEditable()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);
                var bytes = new byte[] { 0, 0, 0 };
                var patientDocumentRepositoryMock = new Mock <IPatientDocumentRepository>();
                var hashingUtility = new Mock <IHashingUtility>();
                hashingUtility.Setup(m => m.ComputeHash(bytes)).Returns("XXXXXXXXXXX");

                var patientDocumentFactory = new PatientDocumentFactory(
                    patientDocumentRepositoryMock.Object, hashingUtility.Object);
                var patient             = new Mock <Patient>();
                var patientDocumentType = new Mock <PatientDocumentType>();


                PatientDocument patientDocument = patientDocumentFactory.CreatePatientDocument(
                    patient.Object,
                    patientDocumentType.Object,
                    bytes,
                    "filename");

                patientDocument.ReviseOtherDocumentTypeName("Other");
            }
        }
        /// <summary>
        /// Processes the single aggregate.
        /// </summary>
        /// <param name="dto">The dto to process.</param>
        /// <param name="entity">The entity.</param>
        /// <returns>A <see cref="System.Boolean"/></returns>
        protected override bool ProcessSingleAggregate(MailAttachmentPatientDocumentDto dto, PatientDocument entity)
        {
            var patientDocumentType = _mappingHelper.MapLookupField <PatientDocumentType>(dto.PatientDocumentType);
            var clinicalDateRange   = new DateRange(dto.ClinicalStartDate, dto.ClinicalEndDate);

            entity.RevisePatientDocumentType(patientDocumentType);
            entity.ReviseClinicalDateRange(clinicalDateRange);
            entity.ReviseDescription(dto.Description);
            entity.ReviseDocumentProviderName(dto.DocumentProviderName);
            entity.ReviseOtherDocumentTypeName(dto.OtherDocumentTypeName);

            return(true);
        }
Example #3
0
        private bool MapProperties(PatientDocumentDto dto, PatientDocument entity)
        {
            var patientDocumentType = _mappingHelper.MapLookupField <PatientDocumentType> (dto.PatientDocumentType);
            var clinicalDateRange   = new DateRange(dto.ClinicalStartDate, dto.ClinicalEndDate);

            entity.RevisePatientDocumentType(patientDocumentType);
            entity.ReviseClinicalDateRange(clinicalDateRange);
            entity.ReviseDescription(dto.Description);
            entity.ReviseDocumentProviderName(dto.DocumentProviderName);
            entity.ReviseOtherDocumentTypeName(dto.OtherDocumentTypeName);

            return(true);
        }