Example #1
0
 public UserController(IMemoryCache memoryCache, IUserService userService, ITestStorage testStorage, IExamService exam)
 {
     ExamService = exam;
     Test        = testStorage;
     MemoryCache = memoryCache;
     UserService = userService;
 }
Example #2
0
 public TestController(IExamService examService, ITestStorage test, IWebHostEnvironment hostingEnvironment, IAdminService adminService)
 {
     Exam = examService;
     Test = test;
     _hostingEnvironment = hostingEnvironment;
     admin = adminService;
 }
Example #3
0
 public ExamController(IWebHostEnvironment hostEnvironment, IExamService examService, ITestStorage testStorage, IAdminService adminService)
 {
     _hostingEnvironment = hostEnvironment;
     Test  = testStorage;
     Exam  = examService;
     admin = adminService;
 }
Example #4
0
 public void SetUp()
 {
     storage     = A.Fake <IStorage>();
     testStorage = A.Fake <ITestStorage>();
     factory     = A.Fake <ITestBuilderFactory>();
     controller  = new TestsController(storage, testStorage, factory, new IExerciseGenerator[0], null);
     ControllerTestsHelper.AttachUserToControllerContext(controller, "admin");
 }
Example #5
0
 public CyberTester(IObjectFactory <IPipelineAction> pipelineActionFactory, ITestStorage testStorage, ILoggerFactory loggerFactory, ICriticalSectionTokensProvider <TestCase> criticalSectionTokensProvider = null, IPriorityProvider priorityProvider = null)
 {
     _pipelineActionFactory         = pipelineActionFactory;
     _testStorage                   = testStorage;
     _loggerFactory                 = loggerFactory;
     _criticalSectionTokensProvider = criticalSectionTokensProvider;
     _priorityProvider              = priorityProvider;
 }
Example #6
0
 public CyberTester(ITestStorage testStorage, ITestCaseProcessorFactory testCaseProcessorFactory, ITestCaseContextFactory testCaseContextFactory, ITestCaseLoggerFactory testCaseLoggerFactory, ILoggerFactory loggerFactory, ISchedule <TestCase> schedule, IEnumerable <ITestCasesPreprocessor> testCasesPreProcessor = null)
 {
     _testStorage              = testStorage;
     _testCasesPreProcessors   = testCasesPreProcessor ?? Enumerable.Empty <ITestCasesPreprocessor>();
     _testCaseLoggerFactory    = testCaseLoggerFactory;
     _testCaseContextFactory   = testCaseContextFactory;
     _testCaseProcessorFactory = testCaseProcessorFactory;
     _loggerFactory            = loggerFactory;
     _schedule = schedule;
 }
Example #7
0
        public TestsController(IStorage storage,
                               ITestStorage testStorage,
                               ITestBuilderFactory testBuilderFactory,
                               IEnumerable <IExerciseGenerator> generators,
                               FilterGenerator filterGenerator)
        {
            this.storage            = storage;
            this.testStorage        = testStorage;
            this.testBuilderFactory = testBuilderFactory;
            this.filterGenerator    = filterGenerator;

            generatorsByCaption = new Dictionary <string, IExerciseGenerator>();
            foreach (var generator in generators)
            {
                generatorsByCaption[generator.GetTypeCaption()] = generator;
            }
        }
        public TestsController_GeneratingTests()
        {
            generators = new IExerciseGenerator[] {
                new OpenQuestionExerciseGenerator(),
                new MatchingQuestionExerciseGenerator(),
                new ChoiceQuestionExerciseGenerator()
            };

            exercises = new Exercise[0];
            cards     = new List <Card>
            {
                new Card("t1", "d1", "admin", id),
                new Card("t2", "d2", "admin", id)
            };
            collection = new Collection("coll", "admin", id);
            testQuery  = new TestQueryDto(id,
                                          new List <TestBlockDto>
            {
                new TestBlockDto(generators[0].GetTypeCaption(), 1),
                new TestBlockDto(generators[1].GetTypeCaption(), 2),
                new TestBlockDto(generators[2].GetTypeCaption(), 3)
            }, null);

            fakeStorage     = A.Fake <IStorage>();
            fakeTestStorage = A.Fake <ITestStorage>();
            factory         = A.Fake <ITestBuilderFactory>();
            fakeBuilder     = A.Fake <ITestBuilder>();

            A.CallTo(() => fakeStorage.FindCollection(A <Guid> ._, A <CancellationToken> ._)).Returns(collection);
            A.CallTo(() => fakeStorage.GetCollectionCards(id, A <CancellationToken> ._)).Returns(cards);
            A.CallTo(() => fakeBuilder.Build()).Returns(exercises);
            A.CallTo(() => fakeBuilder.WithGenerator(A <IExerciseGenerator> ._, A <int> ._)).Returns(fakeBuilder);
            A.CallTo(() => factory.GetBuilder(cards, A <ICardsSelector> ._)).Returns(fakeBuilder);

            controller = new TestsController(fakeStorage, fakeTestStorage, factory, generators, null);
            ControllerTestsHelper.AttachUserToControllerContext(controller, "admin");
        }
Example #9
0
 public TestController(ITestStorage testStorage)
 {
     _testStorage = testStorage;
 }
Example #10
0
 public KeyValueDomain(ITestStorage storage)
 {
     _storage = storage;
 }