public void AddAnswerShouldBeOk()
        {
            var correctAnswers = new List <AnswerDTO>
            {
                new AnswerDTO
                {
                    Id        = 1,
                    Answer    = "test answer 1",
                    IsCorrect = true
                },
                new AnswerDTO
                {
                    Id        = 2,
                    Answer    = "test answer 2",
                    IsCorrect = true
                },
            };
            var sessionAnswer = new SessionAnswerDTO
            {
                Session  = new SessionDTO(),
                Question = new QuestionDTO
                {
                    Id = 1
                },
                Answers = correctAnswers
            };

            _questionRepositoryMock.Setup(repo => repo.Get(It.IsAny <int>())).Returns(new Question
            {
                Id      = 1,
                Answers = new List <Answer>
                {
                    new Answer
                    {
                        Id        = 1,
                        IsCorrect = true
                    },
                    new Answer
                    {
                        Id        = 2,
                        IsCorrect = true
                    }
                }
            });
            _sessionRepositoryMock.Setup(repo => repo.Get(It.IsAny <int>())).Returns(new Session
            {
                Id      = 1,
                Answers = new List <SessionAnswer>()
            });

            var response = _service.AddAnswer(sessionAnswer);

            Assert.IsTrue(response.Success);
            Assert.AreEqual(ResponseCode.Ok, response.Code);
            Assert.AreEqual("Right!", response.Message);
            Assert.IsTrue(response.Data.IsCorrect);
        }
 /// <summary>
 /// Record an answer for a question from an ongoing session.
 /// </summary>
 /// <returns>Answer result.</returns>
 /// <param name="pSessionAnswer">Session answer parameters.</param>
 public ResponseDTO <AnswerResultDTO> AddAnswer(SessionAnswerDTO pSessionAnswer)
 {
     try
     {
         return(_sessionService.AddAnswer(pSessionAnswer));
     }
     catch (Exception ex)
     {
         _logger.Error(ex, "Failed to add answer to the given session.");
         return(ResponseDTO <AnswerResultDTO> .InternalError(
                    ErrorMessageHelper.FailedOperation("recording your answer")));
     }
 }