public void CreateQuestionLoader_ReturnsCorrectType( Type questionType, Type expectedLoaderType) { var questionLoaderFactory = new QuestionLoaderFactory ( dbContext: null ); var result = questionLoaderFactory.CreateQuestionLoader ( (Question)Activator.CreateInstance(questionType) ); Assert.Equal(expectedLoaderType, result.GetType()); }
/// <summary> /// Constructor. /// </summary> public QuestionService( DatabaseContext dbContext, QuestionLoaderFactory questionLoaderFactory, QuestionUpdaterFactory questionUpdaterFactory, QuestionGraderFactory questionGraderFactory, QuestionDuplicatorFactory questionDuplicatorFactory, IQuestionGenerator questionGenerator, IJsonSerializer jsonSerializer, IRandomNumberProvider randomNumberProvider, ITimeProvider timeProvider) { _dbContext = dbContext; _questionLoaderFactory = questionLoaderFactory; _questionUpdaterFactory = questionUpdaterFactory; _questionGraderFactory = questionGraderFactory; _questionDuplicatorFactory = questionDuplicatorFactory; _questionGenerator = questionGenerator; _jsonSerializer = jsonSerializer; _randomNumberProvider = randomNumberProvider; _timeProvider = timeProvider; }
/// <summary> /// Creates a question service. /// </summary> private QuestionService CreateQuestionService( DatabaseContext dbContext, QuestionLoaderFactory questionLoaderFactory = null, QuestionUpdaterFactory questionUpdaterFactory = null, QuestionGraderFactory questionGraderFactory = null, QuestionDuplicatorFactory questionDuplicatorFactory = null, IQuestionGenerator questionGenerator = null, IJsonSerializer jsonSerializer = null, IRandomNumberProvider randomNumberProvider = null, ITimeProvider timeProvider = null) { return new QuestionService ( dbContext, questionLoaderFactory, questionUpdaterFactory, questionGraderFactory, questionDuplicatorFactory, questionGenerator, jsonSerializer, randomNumberProvider, timeProvider ); }