Ejemplo n.º 1
0
        public QuestionDto Map(Question entity)
        {
            var dto = new QuestionDto
                          {
                              Id = entity.Id,
                              QuestionType = entity.QuestionType,
                              ListOrder = entity.ListOrder,
                              IsRequired = entity.IsRequired,
                              Text = entity.Text,
                              Information = entity.Information
                          };

            return dto;
        }
        private static FireRiskAssessmentDto GetFireRiskAssessmentDto()
        {
            long section1Id = 1L;
            long question1Id = 10L;
            long question2Id = 20L;
            long question3Id = 30L;
            long answer1Id = 100L;
            long answer2Id = 200L;
            long answer3Id = 300L;

            var question1Dto = new QuestionDto
            {
                Id = question1Id,
                ListOrder = (int)question1Id,
                Text = "question " + question1Id,
                Information = "some info " + question1Id,
                QuestionType = QuestionType.YesNoNotApplicable,
                IsRequired = false
            };

            var question2Dto = new QuestionDto
            {
                Id = question2Id,
                ListOrder = (int)question2Id,
                Text = "question " + question2Id,
                Information = "some info " + question2Id,
                QuestionType = QuestionType.YesNoNotApplicable,
                IsRequired = false
            };
            var question3Dto = new QuestionDto
            {
                Id = question3Id,
                ListOrder = (int)question3Id,
                Text = "question " + question3Id,
                Information = "some info " + question3Id,
                QuestionType = QuestionType.YesNoNotApplicable,
                IsRequired = false
            };

            var section1Dto = new SectionDto
            {
                Id = section1Id,
                ListOrder = (int)section1Id,
                ShortTitle = "short title " + section1Id.ToString(),
                Title = "normal title " + section1Id.ToString(),
                Questions = new List<QuestionDto>
                            {
                                question1Dto,
                                question2Dto,
                                question3Dto
                            }
            };

            long section2Id = 1L;
            long question4Id = 40L;
            long question5Id = 50L;
            long question6Id = 60L;
            long answer4Id = 400L;
            long answer5Id = 500L;
            long answer6Id = 600L;

            var question4Dto = new QuestionDto
            {
                Id = question4Id,
                ListOrder = (int)question4Id,
                Text = "question " + question4Id,
                Information = "some info " + question4Id,
                QuestionType = QuestionType.YesNoNotApplicable,
                IsRequired = false
            };

            var question5Dto = new QuestionDto
            {
                Id = question5Id,
                ListOrder = (int)question5Id,
                Text = "question " + question5Id,
                Information = "some info " + question5Id,
                QuestionType = QuestionType.YesNoNotApplicable,
                IsRequired = false
            };
            var question6Dto = new QuestionDto
            {
                Id = question6Id,
                ListOrder = (int)question6Id,
                Text = "question " + question6Id,
                Information = "some info " + question6Id,
                QuestionType = QuestionType.YesNoNotApplicable,
                IsRequired = false
            };

            var section2Dto = new SectionDto
            {
                Id = section2Id,
                ListOrder = (int)section2Id,
                ShortTitle = "short title " + section2Id.ToString(),
                Title = "normal title " + section2Id.ToString(),
                Questions = new List<QuestionDto>
                            {
                                question4Dto,
                                question5Dto,
                                question6Dto
                            }
            };

            var checklistDto = new ChecklistDto
            {
                Sections = new List<SectionDto>
                {
                    section1Dto,
                    section2Dto
                }
            };

            var fireAnswer1Dto = new FireAnswerDto
            {
                Id = answer1Id,
                Question = question1Dto,
                AdditionalInfo = "some information",
                YesNoNotApplicableResponse = YesNoNotApplicableEnum.No
            };
            var fireAnswer2Dto = new FireAnswerDto
            {
                Id = answer2Id,
                Question = question2Dto,
                AdditionalInfo = "some information",
                YesNoNotApplicableResponse = YesNoNotApplicableEnum.Yes
            };
            var fireAnswer3Dto = new FireAnswerDto
            {
                Id = answer3Id,
                Question = question3Dto,
                AdditionalInfo = "some information",
                YesNoNotApplicableResponse = YesNoNotApplicableEnum.NotApplicable
            };

            var fireAnswer4Dto = new FireAnswerDto
            {
                Id = answer4Id,
                Question = question4Dto,
                AdditionalInfo = "some information",
                YesNoNotApplicableResponse = YesNoNotApplicableEnum.No
            };
            var fireAnswer5Dto = new FireAnswerDto
            {
                Id = answer5Id,
                Question = question5Dto,
                AdditionalInfo = "some information",
                YesNoNotApplicableResponse = YesNoNotApplicableEnum.Yes
            };
            var fireAnswer6Dto = new FireAnswerDto
            {
                Id = answer6Id,
                Question = question6Dto,
                YesNoNotApplicableResponse = YesNoNotApplicableEnum.NotApplicable
            };

            var fireRiskAssessmentChecklistDto = new FireRiskAssessmentChecklistDto
            {
                Id = 12345L,
                Checklist = checklistDto,
                Answers = new List<FireAnswerDto>
                {
                    fireAnswer1Dto,
                    fireAnswer2Dto,
                    fireAnswer3Dto,
                    fireAnswer4Dto,
                    fireAnswer5Dto,
                    fireAnswer6Dto
                },
                HasCompleteFailureAttempt = true
            };

            var fireRiskAssessmentDto = new FireRiskAssessmentDto
            {
                LatestFireRiskAssessmentChecklist = fireRiskAssessmentChecklistDto
            };

            return fireRiskAssessmentDto;
        }