/// <summary>
 /// Constructor.
 /// </summary>
 public RandomlySelectedQuestionResolver(
     UserQuestionData userQuestionData,
     DatabaseContext dbContext,
     IQuestionLoaderFactory questionLoaderFactory)
 {
     _userQuestionData      = userQuestionData;
     _dbContext             = dbContext;
     _questionLoaderFactory = questionLoaderFactory;
 }
Exemple #2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public UserQuestionDataLoaderFactory(
     DatabaseContext dbContext,
     IQuestionLoaderFactory questionLoaderFactory,
     IUserQuestionDataUpdaterFactory userQuestionDataUpdaterFactory)
 {
     _dbContext                      = dbContext;
     _questionLoaderFactory          = questionLoaderFactory;
     _userQuestionDataUpdaterFactory = userQuestionDataUpdaterFactory;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 public QuestionResolverFactory(
     DatabaseContext dbContext,
     IJsonSerializer jsonSerializer,
     IQuestionLoaderFactory questionLoaderFactory,
     IQuestionStatusCalculator questionStatusCalculator)
 {
     _dbContext                = dbContext;
     _jsonSerializer           = jsonSerializer;
     _questionLoaderFactory    = questionLoaderFactory;
     _questionStatusCalculator = questionStatusCalculator;
 }
Exemple #4
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public QuestionService(
     DatabaseContext dbContext,
     IQuestionValidator questionValidator,
     IQuestionLoaderFactory questionLoaderFactory,
     IQuestionUpdaterFactory questionUpdaterFactory,
     IQuestionDuplicatorFactory questionDuplicatorFactory,
     IQuestionGenerator questionGenerator,
     IJsonSerializer jsonSerializer)
 {
     _dbContext                 = dbContext;
     _questionValidator         = questionValidator;
     _questionLoaderFactory     = questionLoaderFactory;
     _questionUpdaterFactory    = questionUpdaterFactory;
     _questionDuplicatorFactory = questionDuplicatorFactory;
     _questionGenerator         = questionGenerator;
     _jsonSerializer            = jsonSerializer;
 }
Exemple #5
0
 /// <summary>
 /// Creates the user question data loader to test.
 /// </summary>
 private UserQuestionDataLoader CreateUserQuestionDataLoader(
     DatabaseContext dbContext,
     int?questionId = null,
     IQuestionLoaderFactory questionLoaderFactory = null,
     IUserQuestionDataUpdaterFactory userQuestionDataUpdaterFactory = null)
 {
     return(new UserQuestionDataLoader
            (
                dbContext,
                questionLoaderFactory ?? GetMockQuestionLoaderFactory().Object,
                userQuestionDataUpdaterFactory ?? new MockUserQuestionDataUpdaterFactory(),
                "Class1",
                dbContext.Assignments.First().Id,
                dbContext.Users.First().Id,
                GetAssignmentQuestionFilter(questionId),
                GetUserQuestionDataFilter(questionId)
            ));
 }
Exemple #6
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public UserQuestionDataLoader(
     DatabaseContext dbContext,
     IQuestionLoaderFactory questionLoaderFactory,
     IUserQuestionDataUpdaterFactory userQuestionDataUpdaterFactory,
     string classroomName,
     int assignmentId,
     int userId,
     Expression <Func <AssignmentQuestion, bool> > assignmentQuestionsFilter,
     Expression <Func <UserQuestionData, bool> > userQuestionDataFilter)
 {
     _dbContext                      = dbContext;
     _questionLoaderFactory          = questionLoaderFactory;
     _userQuestionDataUpdaterFactory = userQuestionDataUpdaterFactory;
     _classroomName                  = classroomName;
     _assignmentId                   = assignmentId;
     _userId = userId;
     _assignmentQuestionsFilter = assignmentQuestionsFilter;
     _userQuestionDataFilter    = userQuestionDataFilter;
 }
 /// <summary>
 /// Creates a question service.
 /// </summary>
 private QuestionService CreateQuestionService(
     DatabaseContext dbContext,
     IQuestionValidator questionValidator                 = null,
     IQuestionLoaderFactory questionLoaderFactory         = null,
     IQuestionUpdaterFactory questionUpdaterFactory       = null,
     IQuestionDuplicatorFactory questionDuplicatorFactory = null,
     IQuestionGenerator questionGenerator                 = null,
     IJsonSerializer jsonSerializer = null)
 {
     return(new QuestionService
            (
                dbContext,
                questionValidator,
                questionLoaderFactory,
                questionUpdaterFactory,
                questionDuplicatorFactory,
                questionGenerator,
                jsonSerializer
            ));
 }