Example #1
0
        public GameController(string questionsDatabasePath)
        {
            _repository = QuestionRepositoryFactory.CreateObjectDatabaseRespository(questionsDatabasePath);

            _gameLevels = GameLevelFactory.CreateDefaultGameLevels();
            SetActiveLevel(1);
        }
Example #2
0
        static void Main(string[] args)
        {
            if (args == null || args.Length != 1)
            {
                Console.WriteLine("Usage: QuizManager path_to_questions_database_file");
                Console.ReadLine();
                return;
            }

            QuestionRepository = QuestionRepositoryFactory.CreateObjectDatabaseRespository(args[0]);

            new Program().Run();
        }
Example #3
0
 public void DeleteDatabase()
 {
     _repository.Dispose();
     QuestionRepositoryFactory.DropObjectDatabase(_dbPath);
 }
Example #4
0
        public void SetUpDatabase()
        {
            _repository = QuestionRepositoryFactory.CreateObjectDatabaseRespository(_dbPath);

            _repository.AddQuestion(new QuizQuestion()
            {
                QuestionText  = "Question 1",
                CorrectAnswer = "Correct answer",
                WrongAnswer1  = "Wrong answer",
                WrongAnswer2  = "Wrong answer",
                WrongAnswer3  = "Wrong answer",
                Difficulty    = DifficultyLevel.Easy,
            });
            _repository.AddQuestion(new QuizQuestion()
            {
                QuestionText  = "Question 2",
                CorrectAnswer = "Correct answer",
                WrongAnswer1  = "Wrong answer",
                WrongAnswer2  = "Wrong answer",
                WrongAnswer3  = "Wrong answer",
                Difficulty    = DifficultyLevel.Easy,
            });
            _repository.AddQuestion(new QuizQuestion()
            {
                QuestionText  = "Question 3",
                CorrectAnswer = "Correct answer",
                WrongAnswer1  = "Wrong answer",
                WrongAnswer2  = "Wrong answer",
                WrongAnswer3  = "Wrong answer",
                Difficulty    = DifficultyLevel.Medium,
            });
            _repository.AddQuestion(new QuizQuestion()
            {
                QuestionText  = "Question 4",
                CorrectAnswer = "Correct answer",
                WrongAnswer1  = "Wrong answer",
                WrongAnswer2  = "Wrong answer",
                WrongAnswer3  = "Wrong answer",
                Difficulty    = DifficultyLevel.Medium,
            });
            _repository.AddQuestion(new QuizQuestion()
            {
                QuestionText  = "Question 5",
                CorrectAnswer = "Correct answer",
                WrongAnswer1  = "Wrong answer",
                WrongAnswer2  = "Wrong answer",
                WrongAnswer3  = "Wrong answer",
                Difficulty    = DifficultyLevel.Difficult,
            });
            _repository.AddQuestion(new QuizQuestion()
            {
                QuestionText  = "Question 6",
                CorrectAnswer = "Correct answer",
                WrongAnswer1  = "Wrong answer",
                WrongAnswer2  = "Wrong answer",
                WrongAnswer3  = "Wrong answer",
                Difficulty    = DifficultyLevel.Difficult,
            });
            _repository.AddQuestion(new QuizQuestion()
            {
                QuestionText  = "Question 7",
                CorrectAnswer = "Correct answer",
                WrongAnswer1  = "Wrong answer",
                WrongAnswer2  = "Wrong answer",
                WrongAnswer3  = "Wrong answer",
                Difficulty    = DifficultyLevel.Unknown,
            });
        }
 public ImportController(string pathToImportFile, string pathToTargetDb)
 {
     _importFile          = new ImportFile(pathToImportFile);
     _questionRespository = QuestionRepositoryFactory.CreateObjectDatabaseRespository(pathToTargetDb);
 }