public async void GetPlannedInspectionShouldReturnPlannedInspection(int plannedInspectionId)
        {
            var expected = await _dbMock.Object.PlannedInspections.FirstAsync(p => p.Id == plannedInspectionId);

            var actual = await _questionnaireService.GetPlannedInspection(plannedInspectionId);

            Assert.Equal(expected, actual);
        }
        // GET: Inspection/Details/5
        public async Task <ActionResult> Details(int id)
        {
            var plannedInspection = await _questionnaireService.GetPlannedInspection(id);

            var answers = plannedInspection.Answers
                          .Where(e => e.PlannedInspection.Employee.Id == int.Parse(Request.Cookies["CurrentUserId"]))
                          .ToList();

            foreach (var question in plannedInspection.Questionnaire.Questions)
            {
                //check if question exists
                var modifiedQuestion = question;
                if (question is ReferenceQuestion referenceQuestion)
                {
                    modifiedQuestion          = referenceQuestion.Question;
                    modifiedQuestion.Id       = referenceQuestion.Id;
                    modifiedQuestion.Contents = referenceQuestion.Contents;
                    modifiedQuestion.Answers  = referenceQuestion.Answers;

                    foreach (var item in modifiedQuestion.Answers)
                    {
                        item.Question = modifiedQuestion;
                    }
                }

                if (modifiedQuestion.Answers.Any(e => e.PlannedInspection.Id == plannedInspection.Id))
                {
                    continue;
                }

                var answer = _answerFactory.GetAnswer(modifiedQuestion);
                answer.Question          = modifiedQuestion;
                answer.PlannedInspection = plannedInspection;

                answers.Add(answer);
            }

            ViewBag.answers = answers;
            return(View(plannedInspection));
        }