Ejemplo n.º 1
0
        public AssessmentViewModel BuildAssessmentViewModel(Assessment assessment)
        {
            if (assessment == null)
            {
                throw new ArgumentNullException("assessment");
            }

            var viewModel = Mapper.DynamicMap <Assessment, AssessmentViewModel>(assessment);

            viewModel.StageDescription      = ApplicationStringConstants.Stage1Text;
            viewModel.StageDescriptionStyle = ApplicationStringConstants.Stage1ShortDescription;
            viewModel.Patient            = Mapper.DynamicMap <Patient, PatientViewModel>(assessment.Patient);
            viewModel.Status             = Mapper.DynamicMap <Status, StatusViewModel>(assessment.Status);
            viewModel.PatientSummary     = PatientSummary(assessment.Patient);
            viewModel.Terminated         = !string.IsNullOrWhiteSpace(assessment.TerminatedAssessmentReason);
            viewModel.ClinicalSystemName = _clinicalSystemIdDescriptionProvider.GetName();
            return(viewModel);
        }
Ejemplo n.º 2
0
        public void BuildAssessmentViewModel_GivenAssessmentModel_AssessmentViewModelPropertiesShouldBeSet()
        {
            var assessmentId       = Guid.NewGuid();
            var patientId          = Guid.NewGuid();
            var clinicalSystemName = "ClinicalSystemName";
            var assessment         = Assessment(assessmentId, patientId, A <int> ._);

            assessment.TerminatedAssessmentReason = "some reason";
            A.CallTo(() => _clinicalSystemIdDescriptionProvider.GetName()).Returns(clinicalSystemName);
            var result = _builder.BuildAssessmentViewModel(assessment);

            result.AssessmentId.ShouldBeEquivalentTo(assessmentId);
            result.Patient.PatientId.ShouldBeEquivalentTo(patientId);
            result.DateAssessmentStarted.ShouldBeEquivalentTo(new DateTime(2015, 5, 5));
            result.AssessorName.ShouldAllBeEquivalentTo(AssessorName);
            result.Status.StatusId.Should().Be(1);
            result.Stage1InfoText.ShouldAllBeEquivalentTo(Stage1InfoText);
            result.Stage1DecisionToBeMade.ShouldAllBeEquivalentTo(Stage1DecisionToBeMade);
            result.Stage1DecisionConfirmation.ShouldAllBeEquivalentTo(Stage1DecisionConfirmation);
            result.StageDescription.Should().Be(ApplicationStringConstants.Stage1Text);
            result.StageDescriptionStyle.Should().Be(ApplicationStringConstants.Stage1ShortDescription);
            result.Terminated.Should().BeTrue();
            result.ClinicalSystemName.ShouldBeEquivalentTo(clinicalSystemName);
        }