示例#1
0
 public TestsRepositoryTest(Bootstrap bootstrap) : base(bootstrap)
 {
     _testRepository     = _scope.ServiceProvider.GetService <ITestsRepository>();
     _categoryRepository = _scope.ServiceProvider.GetService <ICategoryRepository>();
     _questionRepository = _scope.ServiceProvider.GetService <IQuestionRepository>();
     _userManager        = _scope.ServiceProvider.GetService <UserManager <ApplicationUser> >();
 }
        public EditExerciseTemplatesValidator(ITestsRepository tests, IUserContext user)
        {
            RuleFor(x => x.Description).NotEmpty().WithMessage(string.Format(CoreConfigurationConstants.FieldEmptyMessage, "Description"))
            .MaximumLength(CoreConfigurationConstants.MaxLength)
            .WithMessage(string.Format(CoreConfigurationConstants.FieldMaximumLengthMessage, "Description", CoreConfigurationConstants.MaxLength));

            RuleFor(x => x.TestTemplateId)
            .NotEmpty().WithMessage(string.Format(CoreConfigurationConstants.FieldEmptyMessage, "Test Template Id"))
            .Custom((x, context) =>
            {
                var testsList = tests.GetAllAsync().Result.Where(a => a.Id == x).ToList();

                if (testsList.Count == 0)
                {
                    context.AddFailure("Test Template Id", "Test Template Id is not valid");
                }
                else
                {
                    if (user.GetLogedInUserId() != testsList[0].UserId)
                    {
                        context.AddFailure("Test Template Id", "Unauthorized");
                    }
                }
            });
        }
示例#3
0
 public TesterService(ISitemapProvider smProvider, IResponseTimeTester tester, ITestsRepository testsRepository, IMapper map)
 {
     sitemapProvider    = smProvider;
     responseTimeTester = tester;
     repo   = testsRepository;
     mapper = map;
 }
示例#4
0
        public ScheduledTestsController(ITestInstancesRepository testInstancesRepository,
                                        IMapper mapper,
                                        IUserContext userContext,
                                        IGroupsRepository groupsRepository,
                                        ITestsRepository testsRepository,
                                        IAnswersRepository answersRepository,
                                        IExercisesRepository exercisesRepository,
                                        ITestTypesRepository testTypesRepository)
        {
            _testInstancesRepository = testInstancesRepository;
            _mapper              = mapper;
            _groupsRepository    = groupsRepository;
            _testsRepository     = testsRepository;
            _answersRepository   = answersRepository;
            _exercisesRepository = exercisesRepository;
            _testTypesRepository = testTypesRepository;

            var userId = userContext.GetLogedInUserId();

            if (userId == null)
            {
                throw new ApplicationException("userId is null");
            }
            _userId = (Guid)userId;
        }
示例#5
0
 public TestConductController(ITestConductRepository testConductRepository, ITestsRepository testRepository, IStringConstants stringConstants, ILogger <TestConductController> logger)
 {
     _testConductRepository = testConductRepository;
     _testRepository        = testRepository;
     _stringConstants       = stringConstants;
     _logger = logger;
 }
示例#6
0
        public ContestController(IContestRepository contestRepository, IUserContestRepository userContestRepository, IProblemContestRepository problemContestRepository,
                                 ISubmisionContestRepository submisionContestRepository, IAnnouncementRepository announcementRepository, IProblemRepository problemRepository,
                                 ISubmisionRepository submisionRepository, IMessageBuilder emailSender, UserManager <User> userManager,
                                 IConfiguration configuration, ITestsRepository testsRepository, SubmissionHub submissionHub,
                                 IHubContext <SubmissionHub> hubContext, ISerializeTests serializeTests,
                                 IEvaluationRepository evaluationRepository, IUserInformationRepository userInformation)
        {
            _contestRepository          = contestRepository;
            _userContestRepository      = userContestRepository;
            _problemContestRepository   = problemContestRepository;
            _submisionContestRepository = submisionContestRepository;
            _announcementRepository     = announcementRepository;
            _problemRepository          = problemRepository;
            _submisionRepository        = submisionRepository;
            _compilers   = Compilator.Compilers;
            _emailSender = emailSender;
            _userManager = userManager;


            _configuration        = configuration;
            _testRepository       = testsRepository;
            _submissionHub        = submissionHub;
            _evaluationRepository = evaluationRepository;
            _hubContext           = hubContext;
            _serializeTests       = serializeTests;
            _userInformation      = userInformation;

            //intialize compilation and running api
            _compilationApi = _configuration.GetSection("Api")["CompilationApi"];
            _executionApi   = _configuration.GetSection("Api")["ExecutionApi"];
        }
示例#7
0
 public TestsController(ITestsRepository testsRepository, IConfiguration configuration,
                        IProblemRepository problemRepository)
 {
     _testRepository    = testsRepository;
     _configuration     = configuration;
     _problemRepository = problemRepository;
     _testApi           = _configuration.GetSection("Api")["TestsApi"];
     _deleteTestApi     = _testApi + "/deleteTest";
 }
示例#8
0
 public QuestionsRepositoryTest(Bootstrap bootstrap) : base(bootstrap)
 {
     //resolve dependency to be used in tests
     _questionRepository = _scope.ServiceProvider.GetService <IQuestionRepository>();
     _categoryRepository = _scope.ServiceProvider.GetService <ICategoryRepository>();
     _userManager        = _scope.ServiceProvider.GetService <UserManager <ApplicationUser> >();
     _testRepository     = _scope.ServiceProvider.GetService <ITestsRepository>();
     ClearDatabase.ClearDatabaseAndSeed(_trappistDbContext);
 }
 public DataManager(IAnswersRepository answersRepository, IQuestionsRepository questionsRepository, ITestsRepository testsRepository, IStatisticRepository statisticRepository, IUsersRepository usersRepository, IWrittenLettersRepository writtenLettersRepository)
 {
     this.answersRepository        = answersRepository;
     this.questionsRepository      = questionsRepository;
     this.testsRepository          = testsRepository;
     this.statisticRepository      = statisticRepository;
     this.writtenLettersRepository = writtenLettersRepository;
     this.usersRepository          = usersRepository;
 }
示例#10
0
        public MainController(IImageRepository imageRepository, ITestsRepository testsRepository)
        {
            _imgRepo   = imageRepository;
            _testsRepo = testsRepository;

            _imgInStepCount = 2;
            _stepsMaxCount  = 10;
            _stylesCount    = _imgRepo.GetAllStyles().Count;
        }
 public DataManagerMock(IAnswersRepository answersRepository, IQuestionsRepository questionsRepository,
                        ITestsRepository testsRepository, IStatisticRepository statisticRepository, IUsersRepository usersRepository, IWrittenLettersRepository writtenLettersRepository)
 {
     Answers        = answersRepository;
     Questions      = questionsRepository;
     Tests          = testsRepository;
     Statistic      = statisticRepository;
     Users          = usersRepository;
     WrittenLetters = writtenLettersRepository;
 }
 public DataManager(IAnswersRepository answersRepository, ITestsRepository testsRepository, IQuestionsRepository quesionsRepository, IUsersRepository usersRepository, ICorrectAnswerRepository correctAnswerRepository, IUserTestAccessRepository userTestAccessRepository, IStatisticRepository statisticRepository)
 {
     _answersRepository        = answersRepository;
     _testsRepository          = testsRepository;
     _quesionsRepository       = quesionsRepository;
     _usersRepository          = usersRepository;
     _correctAnswerRepository  = correctAnswerRepository;
     _userTestAccessRepository = userTestAccessRepository;
     _statisticRepository      = statisticRepository;
 }
示例#13
0
 public TestConductRepositoryTest(Bootstrap bootstrap) : base(bootstrap)
 {
     _testConductRepository = _scope.ServiceProvider.GetService <ITestConductRepository>();
     _testRepository        = _scope.ServiceProvider.GetService <ITestsRepository>();
     _globalUtil            = _scope.ServiceProvider.GetService <Mock <IGlobalUtil> >();
     _stringConstants       = _scope.ServiceProvider.GetService <IStringConstants>();
     _categoryRepository    = _scope.ServiceProvider.GetService <ICategoryRepository>();
     _userManager           = _scope.ServiceProvider.GetService <UserManager <ApplicationUser> >();
     _questionRepository    = _scope.ServiceProvider.GetService <IQuestionRepository>();
     _httpService           = _scope.ServiceProvider.GetService <Mock <IHttpService> >();
 }
示例#14
0
 public DataManager(IDetailsOfTheTestRepository detailsOfTheTestRepository, IStudentAnswersRepository studentAnswersRepository, IAnswersRepository answersRepository, IQuestionsRepository questionsRepository, ITestsRepository testsRepository, IRolesRepository rolesRepository, IGroupsRepository groupsRepository, IStudentsRepository studentsRepository, IUsersRepository usersRepository)
 {
     Users            = usersRepository;
     Roles            = rolesRepository;
     Tests            = testsRepository;
     Groups           = groupsRepository;
     Answers          = answersRepository;
     Students         = studentsRepository;
     Questions        = questionsRepository;
     StudentAnswers   = studentAnswersRepository;
     DetailsOfTheTest = detailsOfTheTestRepository;
 }
示例#15
0
 public DataManagerMock(IAnswersRepository answersRepository, ITestsRepository testsRepository,
                        IQuestionsRepository questionsRepository, IUsersRepository usersRepository,
                        ICorrectAnswerRepository correctAnswerRepository, IUserTestAccessRepository userTestAccess, IStatisticRepository statisticRepository)
 {
     Answers        = answersRepository;
     Tests          = testsRepository;
     Questions      = questionsRepository;
     Users          = usersRepository;
     CorrectAnswers = correctAnswerRepository;
     UserTestAccess = userTestAccess;
     Statistics     = statisticRepository;
 }
示例#16
0
        public SubmissionController(ISubmisionRepository submisionRepository, IConfiguration configuration,
                                    IProblemRepository problemRepository, IEvaluationRepository evaluationRepository,
                                    ITestsRepository testsRepository)
        {
            _submisionRepository  = submisionRepository;
            _configuration        = configuration;
            _problemRepository    = problemRepository;
            _evaluationRepository = evaluationRepository;
            _testRepository       = testsRepository;

            //intialize compilation and running api
            _compilationApi = _configuration.GetSection("Api")["CompilationApi"];
            _executionApi   = _configuration.GetSection("Api")["ExecutionApi"];
        }
示例#17
0
        public TestsController(ITestInstancesRepository testInstancesRepository,
                               IUserContext userContext,
                               ITestsRepository testsRepository)
        {
            _testInstancesRepository = testInstancesRepository;
            _testsRepository         = testsRepository;

            var userId = userContext.GetLogedInUserId();

            if (userId == null)
            {
                throw new ApplicationException("userId is null");
            }
            _userId = (Guid)userId;
        }
示例#18
0
        public TestTemplatesController(ITestsRepository testsRepository, IMapper mapper,
                                       IUserContext userContext,
                                       ITestTypesRepository testTypesRepository,
                                       IExercisesRepository exercisesRepository)
        {
            _testsRepository     = testsRepository;
            _mapper              = mapper;
            _testTypesRepository = testTypesRepository;
            _exercisesRepository = exercisesRepository;

            var userId = userContext.GetLogedInUserId();

            if (userId == null)
            {
                throw new ApplicationException("userId is null");
            }
            _userId = (Guid)userId;
        }
示例#19
0
        public TestConductRepository(TrappistDbContext dbContext
                                     , ITestsRepository testRepository
                                     , IConfiguration configuration
                                     , IQuestionRepository questionRepository
                                     , IStringConstants stringConstants
                                     , IHttpService httpService)
        {
            _dbContext          = dbContext;
            _testRepository     = testRepository;
            _questionRepository = questionRepository;
            _configuration      = configuration;
            _stringConstants    = stringConstants;
            _httpService        = httpService;

            if (_configuration["EnableCache"] != null && Convert.ToBoolean(_configuration["EnableCache"]))
            {
                _enableCache = true;
            }
        }
示例#20
0
        public ProblemsController(IProblemRepository problemRepository, ISubmisionRepository submisionRepository,
                                  ISolutionRepository solutionRepository, IConfiguration configuration,
                                  ITestsRepository testsRepository, SubmissionHub submissionHub,
                                  IHubContext <SubmissionHub> hubContext, ISerializeTests serializeTests,
                                  IEvaluationRepository evaluationRepository)
        {
            _problemRepository    = problemRepository;
            _submisionRepository  = submisionRepository;
            _solutionRepository   = solutionRepository;
            _configuration        = configuration;
            _testRepository       = testsRepository;
            _submissionHub        = submissionHub;
            _evaluationRepository = evaluationRepository;
            _hubContext           = hubContext;
            _serializeTests       = serializeTests;
            _compilers            = Compilator.Compilers;

            //intialize compilation and running api
            _compilationApi = _configuration.GetSection("Api")["CompilationApi"];
            _executionApi   = _configuration.GetSection("Api")["ExecutionApi"];
        }
示例#21
0
 public DbSeeder(
     DatabaseContext databaseContext,
     IServiceProvider serviceProvider,
     RoleManager <Role> roleManager,
     UserManager <User> userManager,
     IGroupsRepository groupsRepository,
     ITestTypesRepository testTypesRepository,
     IUsersRepository usersRepository,
     ITestsRepository testsRepository,
     IExercisesRepository exercisesRepository,
     IAnswersRepository answersRepository)
 {
     _databaseContext     = databaseContext;
     _serviceProvider     = serviceProvider;
     _roleManager         = roleManager;
     _userManager         = userManager;
     _groupsRepository    = groupsRepository;
     _testTypesRepository = testTypesRepository;
     _usersRepository     = usersRepository;
     _testsRepository     = testsRepository;
     _exercisesRepository = exercisesRepository;
     _answersRepository   = answersRepository;
 }
 public TestController(ILogger <TestController> logger, ITestsRepository testsRepository)
 {
     _testsRepository = testsRepository;
 }
示例#23
0
 public TestService(ITestsRepository testsRepo)
 {
     _testsRepo = testsRepo;
 }
示例#24
0
 public TestService(ITestsRepository repo)
 {
     _repo = repo;
 }
 public TestsController(ITestsRepository testsRepo)
 {
     _rep = testsRepo;
 }
示例#26
0
 public TestsController(ITestsRepository _testsRepository)
 {
     testsRepository = _testsRepository;
 }
 public StudentsController(ITestsRepository testsRepository, ITestsService testsService)
 {
     _testsRepository = testsRepository;
     _testsService    = testsService;
 }
示例#28
0
 public TestsController(ITestsRepository repository)
 {
     _repository = repository;
 }
示例#29
0
 public TestsController(ITestsRepository testRepository, IStringConstants stringConstants, UserManager <ApplicationUser> userManager)
 {
     _testRepository  = testRepository;
     _stringConstants = stringConstants;
     _userManager     = userManager;
 }
 public MongoTestsRepositoryTest()
 {
     _repo = new MongoTestsRepository();
 }