public QuestionValidatorFactory(
     IQuestionValidatorClosedOneAnswer questionValidatorClosedOneAnswer,
     IQuestionValidatorClosedManyAnswers questionValidatorClosedManyAnswers,
     IQuestionValidatorOpenedOneString questionValidatorOpenedOneString,
     IQuestionValidatorWithProgram questionValidatorWithProgram)
 {
     _questionValidatorClosedOneAnswer   = questionValidatorClosedOneAnswer;
     _questionValidatorClosedManyAnswers = questionValidatorClosedManyAnswers;
     _questionValidatorOpenedOneString   = questionValidatorOpenedOneString;
     _questionValidatorWithProgram       = questionValidatorWithProgram;
 }
        public QuestionValidatorTests()
        {
            var mapper = new Mapper(new MapperConfiguration(ConfigureMapper));

            _questionValidatorClosedOneAnswer = new QuestionValidatorClosedOneAnswer(
                mapper,
                _context.Object,
                _hashComputer.Object,
                _repositoryQuestion.Object);

            _questionValidatorClosedManyAnswers = new QuestionValidatorClosedManyAnswers(
                mapper,
                _context.Object,
                _hashComputer.Object,
                _repositoryQuestion.Object);

            _questionValidatorOpenedOneString = new QuestionValidatorOpenedOneString(
                mapper,
                _context.Object,
                _hashComputer.Object,
                _repositoryQuestion.Object);

            _questionValidatorWithProgram = new QuestionValidatorWithProgram(
                mapper,
                _context.Object,
                _hashComputer.Object,
                _repositoryQuestion.Object,
                _codeRunner.Object);

            _context
            .Setup(x => x.GetCurrentUserAsync())
            .ReturnsAsync(ModelsCreationHelper.CreateStudent);

            _context
            .Setup(x => x.GetCurrentUser())
            .Returns(ModelsCreationHelper.CreateStudent);

            _hashComputer
            .Setup(x => x.ComputeForQuestionAsync(It.IsAny <DatabaseQuestion>()))
            .ReturnsAsync("hash");

            _repositoryQuestion
            .Setup(x => x.FindFirstAsync(It.IsAny <ISpecification <DatabaseQuestion> >()))
            .ReturnsAsync((ISpecification <DatabaseQuestion> x) => _questions.AsQueryable().FirstOrDefault(x.ToExpression()));
        }