private void AddEndAssessmentInformation(Assessment assessment) { if (assessment.DateAssessmentEnded != null) { _pdfHelper.AddLine(); var date1 = (DateTime)assessment.DateAssessmentEnded; var datePart = date1.Date; _pdfHelper.AddTitle(ApplicationStringConstants.AssessmentCompleteDateText); _pdfHelper.AppendText(" " + datePart.ToString("D")); } if (!string.IsNullOrWhiteSpace(assessment.TerminatedAssessmentReason)) { _pdfHelper.AddLine(); _pdfHelper.AddTitle(ApplicationStringConstants.AssessmentTerminationReasonString); _pdfHelper.AppendText(" " + assessment.TerminatedAssessmentReason); } }
public void CreatePdfForAssessment_CalledWithValidAssessmentAndEmptyDecisionMaker_ShouldCreatePdfContainingCommonInformation() { PdfDocument pdfDocumentCreated; var assessment = new Assessment() { AssessmentId = Guid.NewGuid(), Stage1DecisionToBeMade = "Decision", Patient = new Patient() { FirstName = "First name", LastName = "Last name", DateOfBirth = new DateTime(1956, 1, 02), NhsNumber = 4010232137, ClinicalSystemId = "1234567890" }, AssessorName = "assessor", Role = new Role { RoleId = (int)RoleIdEnum.Assessor, Description = "A random role" }, DateAssessmentStarted = _dateTimeProvider.Now, }; _pdfGenerator.CreatePdfForAssessment(assessment, out pdfDocumentCreated); A.CallTo(() => _pdfHelper.AddTitle(ApplicationStringConstants.McaSubject, false, true)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _pdfHelper.AddTitle(ApplicationStringConstants.Name, true, false)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _pdfHelper.AppendText(" " + assessment.Patient.FirstName + " " + assessment.Patient.LastName)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _pdfHelper.AddTitle(ApplicationStringConstants.Dob, true, false)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _pdfHelper.AppendText(" " + assessment.Patient.DateOfBirth.ToLongDateString())).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _pdfHelper.AddTitle(ApplicationStringConstants.NhsNumber, true, false)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _pdfHelper.AppendText(" " + assessment.Patient.NhsNumber)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _pdfHelper.AddTitle(ApplicationStringConstants.AssessmentStartDateText, true, false)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _pdfHelper.AddTitle(ApplicationStringConstants.ClinicianNameText, true, false)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _pdfHelper.AddTitle(ApplicationStringConstants.Stage1Text, false, false)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _pdfHelper.AddTitle(ApplicationStringConstants.DecisionToBeMade, false, false)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _pdfHelper.WriteText(assessment.Stage1DecisionToBeMade)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _pdfHelper.AddTitle(ApplicationStringConstants.RoleText, true, false)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _pdfHelper.AppendText(" " + assessment.Role.Description)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _pdfHelper.AddTitle(ApplicationStringConstants.DecisionMakerText, true, false)).MustNotHaveHappened(); }