Beispiel #1
0
        private Dtos.Test.QuestionAnswerDto MapUserAnswer(WrittenUserAnswer writtenAnswer)
        {
            var writtenDto = new WrittenAnswerDto
            {
                QuestionId = writtenAnswer.QuestionId,
                Text       = writtenAnswer.Value
            };

            return(writtenDto);
        }
Beispiel #2
0
        public void MapToUserAnswer_WrittenUserAnswerDto_UserAnswer()
        {
            //arrange
            string value            = "answer";
            int    questionId       = 1;
            int    testId           = 2;
            int    userId           = 3;
            var    writtenAnswerDto = new Dtos.Test.WrittenAnswerDto
            {
                QuestionId = questionId,
                Text       = value
            };
            UserAnswer expectedUserAnswer = new WrittenUserAnswer(value, testId, questionId, userId);

            //act
            var userAnswer = mapper.MapToUserAnswer(writtenAnswerDto, testId, userId);

            //assert
            userAnswer.Should().BeEquivalentTo(expectedUserAnswer);
        }