Example #1
0
    protected void StartQuestion(QuestionCategory category)
    {
        if (timeBar != null)
        {
            UIWidget widget = timeBar.foreground.GetComponent <UIWidget>();
            if (widget == null)
            {
                Debug.LogError("No Time Bar foreground found");
                return;
            }

            switch (category)
            {
            case QuestionCategory.Easy:
                widget.color = new Color(0.43f, 0.7f, 0.47f);
                break;

            case QuestionCategory.Medium:
                widget.color = new Color(0.4f, 0.49f, 0.75f);
                break;

            case QuestionCategory.Hard:
                widget.color = new Color(0.98f, 0.53f, 0.53f);
                break;
            }
        }
    }
Example #2
0
        public static QuestionnaireTemplate FillNewQuestionnaireWithAnswers(IQuestionnaireService service, int[] answers,
                                                                            DateTime now, int userId)
        {
            GenericError          error;
            QuestionnaireTemplate localizedTemplate = service.GetQuestionnaireTemplate(1, locale, out error,
                                                                                       DateTime.Now, userId);

            Assert.IsTrue(localizedTemplate.QuestionCategories.Count == 7);

            for (int i = 0; i < localizedTemplate.QuestionCategories.Count; i++)
            {
                QuestionCategory q = localizedTemplate.QuestionCategories[i];
                q.CategoryQuestion.QuestionAnwer = new QuestionAnwer {
                    Answer = answers[i]
                };
            }

            localizedTemplate.QuestionCategories.ForEach(
                cq => cq.Questions.ForEach(q => q.QuestionAnwer = new QuestionAnwer {
                Answer = 1
            }));
            localizedTemplate.QuestionCategories[5].Questions[3].QuestionAnwer.Answer = -1;
            service.SubmitAnsweredTemplate(userId, localizedTemplate, now);
            return(localizedTemplate);
        }
Example #3
0
        public async Task <QuestionInfo> RandomSelect(QuestionCategory questionCategory, int minDifficult)
        {
            if (minDifficult < QuestionConstants.QuestionMinDifficult ||
                minDifficult > QuestionConstants.QuestionMaxDifficult)
            {
                throw new ArgumentOutOfRangeException(nameof(minDifficult));
            }

            int questionCount = await questionInfoStatisticService.GetQuestionCount(questionCategory, minDifficult);

            if (questionCount <= 0)
            {
                throw new ApplicationException($"Can't find any question with {questionCategory} and {minDifficult}.");
            }

            int skipNum      = random.Next(0, questionCount);
            int maxDifficult = minDifficult + QuestionConstants.QuestionSelectDifficultRange;

            using SessionWrapper sessionWrapper         = questionInfoRepository.GetSessionWrapper(true);
            using TransactionWrapper transactionWrapper = sessionWrapper.BuildTransaction(true);
            IQueryable <QuestionInfo> questionInfoQuery = questionInfoRepository.GetQueryable(sessionWrapper);

            questionInfoQuery = questionInfoQuery.Where(m => m.QuestionCategory == questionCategory);
            questionInfoQuery =
                questionInfoQuery.Where(m => m.Difficult >= minDifficult && m.Difficult < maxDifficult);
            return(await questionInfoQuery.Skip(skipNum).Take(1).FirstOrDefaultAsync());
        }
Example #4
0
 public void RemoveQuestion(Question question, QuestionCategory category)
 {
     category.SubQuestionsGuids.Remove(question.UniqueGuid);
     manager.questions.Remove(question);
     namer.list.Remove(namer.list.Find(s => s.guid == question.UniqueGuid));
     translations.RemoveQuestionDesc(question.UniqueGuid);
 }
 public object BuildNode(QuestionCategory category, bool isOpened = false, bool isSelected = false, dynamic[] children = null)
 {
     if (children == null)
     {
         return(new
         {
             id = category.Id,                                                      // required
             parent = category.ParentID != null?category.ParentID.ToString() : "#", // required
                          text = $"{category.Name} ({category.Id})",
                          state = new { opened = isOpened, selected = isSelected },
             children = HasChild(category.Id),       // node text
             isLeaf = HasChild(category.Id)
         });
     }
     else
     {
         return(new
         {
             id = category.Id,                                                      // required
             parent = category.ParentID != null?category.ParentID.ToString() : "#", // required
                          text = $"{category.Name} ({category.Id})",
                          state = new { opened = isOpened, selected = isSelected },
             children = children,            // node text
             isLeaf = HasChild(category.Id)
         });
     }
 }
Example #6
0
        /// <summary>
        /// Updates a question category.
        /// </summary>
        public async Task UpdateQuestionCategoryAsync(
            string classroomName,
            QuestionCategory questionCategory)
        {
            var currentQuestionCategory = await GetQuestionCategoryAsync
                                          (
                classroomName,
                questionCategory.Id
                                          );

            _dbContext.Entry(currentQuestionCategory).State = EntityState.Detached;

            if (currentQuestionCategory.RandomlySelectedQuestionId != null)
            {
                throw new InvalidOperationException
                      (
                          "Cannot update category containing choices for a randomly selected question."
                      );
            }

            questionCategory.ClassroomId = currentQuestionCategory.ClassroomId;
            _dbContext.Update(questionCategory);

            await _dbContext.SaveChangesAsync();
        }
Example #7
0
        public ActionResult Edit(QuestionCategory Question, int id)
        {
            try
            {
                QuestionCategory prodToEdit = context.FindById(id);
                if (prodToEdit == null)
                {
                    return(HttpNotFound());
                }
                else
                {
                    if (!ModelState.IsValid)
                    {
                        return(View(Question));
                    }
                    else
                    {
                        //context.Update(Question); ce n'est un context EF
                        prodToEdit.Category = Question.Category;

                        context.SaveChanges();
                        return(RedirectToAction("Index"));
                    }
                }
            }
            catch (Exception)
            {
                return(HttpNotFound());
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("Name,Id")] QuestionCategory questionCategory)
        {
            if (id != questionCategory.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.QuestionCategories.Update(questionCategory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!QuestionCategoryExists(questionCategory.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(questionCategory));
        }
Example #9
0
 public Question(int id)
 {
     {
         Answers = new Answers().GetAnswers(id);
         var connectionString =
             ConfigurationManager.ConnectionStrings["lbkmobile_ConnectionString"].ConnectionString;
         var objConn = new SqlConnection(connectionString);
         try
         {
             objConn.Open();
             var strSql = @"SELECT * from Questions where id=" + id.ToString(CultureInfo.InvariantCulture);
             SqlDataReader myReader = null;
             var myCommand = new SqlCommand(strSql, objConn);
             myReader = myCommand.ExecuteReader();
             while (myReader.Read())
             {
                 Description = myReader["Description"].ToString();
                 Number = int.Parse(myReader["Number"].ToString());
                 Points = int.Parse(myReader["Points"].ToString());
                 SerieId = int.Parse(myReader["SerieId"].ToString());
                 Category = (QuestionCategory) int.Parse(myReader["CategoryId"].ToString());
             }
             myReader.Close();
         }
         catch(Exception ex)
         {
             objConn.Close();
             Logger.Append("QuestionList: " + ex.Message, Logger.ERROR);
         }
         finally
         {
             objConn.Close();
         }
     }
 }
Example #10
0
 public TriviaGame(ulong channel, int questions = 1, QuestionCategory category = QuestionCategory.All)
 {
     this.ChannelId     = channel;
     this.Category      = category;
     this.QuestionCount = questions;
     this.Players       = new ConcurrentDictionary <ulong, TriviaPlayer>();
 }
Example #11
0
        public async Task <IActionResult> Edit(int id, [Bind("QuestionCategoryId,Denumire")] QuestionCategory questionCategory)
        {
            if (id != questionCategory.QuestionCategoryId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.QuestionCategory.Update(questionCategory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!QuestionCategoryExists(questionCategory.QuestionCategoryId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                TempData["Message"] = "Tip intrebare actualizat cu succes!";
                TempData["Success"] = "true";
                return(RedirectToAction("Index", "Questions"));
            }
            return(View(questionCategory));
        }
Example #12
0
        public async Task <QuestionCategory> AddCategoryAsync(Form form, QuestionCategory category)
        {
            form.Categories.Add(category);
            await _context.SaveChangesAsync();

            return(category);
        }
Example #13
0
        public ScoreCardCategoryScore this[QuestionCategory questionCategory]
        {
            get
            {
                switch (questionCategory)
                {
                case QuestionCategory.EditorialInformation:
                    return(this.EditorialInformationScore);

                case QuestionCategory.PeerReview:
                    return(this.PeerReviewScore);

                case QuestionCategory.Governance:
                    return(this.GovernanceScore);

                case QuestionCategory.Process:
                    return(this.ProcessScore);

                case QuestionCategory.Valuation:
                    return(this.ValuationScore);

                default:
                    throw new ArgumentOutOfRangeException(nameof(questionCategory));
                }
            }
        }
Example #14
0
        private static void Case1()
        {
            QuestionCategory category;

            Console.WriteLine("Przeciągnij plik z pytaniem i kliknij enter.");
            var questionToLoad = (Question) new XmlSerializer(typeof(Question)).Deserialize(File.OpenRead(Console.ReadLine()));

            lesson   = GetLesson();
            category = categories.Find(s => s.CategoryUserFriendlyName == lesson);
            if (category is null)
            {
                category = new QuestionCategory();
                category.CategoryUserFriendlyName = lesson;
                category.UniquePath = $"\\custom\\{category.CategoryUserFriendlyName}";
                customs.SubcategoriesUniquePaths.Add($"\\custom\\{category.CategoryUserFriendlyName}");
                categories.Add(category);
                translations.AddLessonDesc(category.CategoryUserFriendlyName);
            }

            Guid guid = Guid.NewGuid();

            category.SubQuestionsGuids.Add(guid.ToString());
            questionToLoad.UniqueGuid = guid.ToString();

            questions.Add(questionToLoad);
            translations.AddQuestionDesc(guid.ToString(), questionToLoad.Description);
            Console.WriteLine($"Dodano pytanie. Intentyfikator: {guid}");
        }
        protected async void btnSave_Click(object sender, EventArgs e)
        {
            string questionName    = this.txtQuestionName.Text.Trim();
            string questionSummary = this.txtQuestionSummary.Text.Trim();

            using (var context = new ReportContext())
            {
                if (this.hideAction.Value == "add")
                {
                    var entity = new QuestionCategory
                    {
                        Name    = questionName,
                        Summary = questionSummary
                    };
                    context.QuestionCategories.Add(entity);
                }
                if (this.hideAction.Value == "edit")
                {
                    string id     = this.hideQuestionID.Value;
                    var    entity = context.QuestionCategories.Find(int.Parse(id));
                    if (entity != null)
                    {
                        entity.Name    = questionName;
                        entity.Summary = questionSummary;
                    }
                }
                await context.SaveChangesAsync();

                InitRepeater1(this.AspNetPager1.CurrentPageIndex);
                this.ddlRelateQuestion.DataBind();
            }
        }
Example #16
0
        private void SerializationButton_OnClick(object sender, RoutedEventArgs e)
        {
            QuestionCategory category = (QuestionCategory)Difficulties.SelectedItem;

            AnswerDTO[] answers = new AnswerDTO[]
            {
                new AnswerDTO {
                    Text = Answer1TextBox.Text, IsRight = (bool)Answer1RadioButton.IsChecked
                },
                new AnswerDTO {
                    Text = Answer2TextBox.Text, IsRight = (bool)Answer2RadioButton.IsChecked
                },
                new AnswerDTO {
                    Text = Answer3TextBox.Text, IsRight = (bool)Answer3RadioButton.IsChecked
                },
                new AnswerDTO {
                    Text = Answer4TextBox.Text, IsRight = (bool)Answer4RadioButton.IsChecked
                }
            };

            QuestionDTO question = new QuestionDTO {
                Category = category, Answers = answers, QuestionText = QuestionTextBox.Text
            };

            ((AdministrationViewModel)(DataContext)).AddQuestion(question);
        }
Example #17
0
 public void RemoveFirstQuestionOf(QuestionCategory questionCategory)
 {
     var question
         = _questions.FirstOrDefault(a => a.Category() == questionCategory);
     if (question != null)
         _questions.Remove(question);
 }
Example #18
0
        public ActionResult CreateEdit(QuestionCategory questioncategory)
        {
            bool uniqueViolation = db.QuestionCategories.Any(x => x.categoryName == questioncategory.categoryName &&
                                                             x.categoryId != questioncategory.categoryId);

            if (ModelState.IsValid && !uniqueViolation)
            {
                //No Id => Add
                if (questioncategory.categoryId <= 0)
                {
                    db.QuestionCategories.Add(questioncategory);
                }
                //Is Id => Update
                else
                {
                    db.Entry(questioncategory).State = EntityState.Modified;
                }

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Warning = "Name must be unique!";
            return(View(questioncategory));
        }
Example #19
0
        private QuestionCategory GetQuestionCategory()
        {
            QuestionCategory[] questionCategories = Enum.GetValues <QuestionCategory>();
            QuestionCategory   questionCategory   = questionCategories[random.Next(0, questionCategories.Length)];

            return(questionCategory);
        }
        public ActionResult AddOrUpdate(QuestionCategoriesViewModelContainer categoryModel)
        {
            int parentCategory = 0;

            if (String.IsNullOrEmpty(categoryModel.QuestionCategoryViewModel.Parent))
            {
                parentCategory = _categoryService.GetQuestionCategory(categoryModel.QuestionCategoryViewModel.Parent).Id;
            }

            QuestionCategory category = new QuestionCategory()
            {
                Id         = categoryModel.QuestionCategoryViewModel.Id,
                Name       = categoryModel.QuestionCategoryViewModel.Name,
                ParentID   = parentCategory,
                AnswerType = categoryModel.QuestionCategoryViewModel.QuestionAnswerType
            };

            List <QuestionAnswer> questionAnswers = new List <QuestionAnswer>();

            foreach (QuestionAnswerViewModel model in categoryModel.QuestionAnswerViewModel)
            {
                questionAnswers.Add(_mapper.Map <QuestionAnswer>(model));
            }

            category.QuestionAnswers = questionAnswers;
            _categoryService.AddOrUpdate(category);

            return(RedirectToAction("Index", categoryModel));
        }
 public LessonView(QuestionCategory category, MainLogic logic)
 {
     InitializeComponent();
     Category = category;
     Logic    = logic;
     ReloadList();
 }
Example #22
0
 public static ExtendedQuestionCategory ExtendCategory(QuestionCategory <QuestionEntry> category, IEnumerable <Int32> points)
 {
     return(new ExtendedQuestionCategory
     {
         Heading = category.Heading,
         QuestionEntries = category.QuestionEntries.Zip(points, ExtendedQuestionEntry.ExtendQuestion).ToList()
     });
 }
Example #23
0
        public void QuestionsNotEmptyTest(uint amount, QuestionCategory category, QuestionDifficulty difficulty, QuestionType type, ResponseEncoding encoding)
        {
            // Act
            var response = TriviaApi.RequestQuestions(amount, category, difficulty, type, encoding);

            // Assert
            Assert.NotEmpty(response.Questions);
        }
Example #24
0
        public ActionResult DeleteConfirmed(int id)
        {
            QuestionCategory ObjQuestionCategory = db.QuestionCategorys.Find(id);

            db.QuestionCategorys.Remove(ObjQuestionCategory);
            db.SaveChanges();
            return(Redirect(TempData["ThisUrl"].ToString()));
        }
Example #25
0
 public string GetNextQuestionBy(QuestionCategory questionCategory)
 {
     var question
         = _questions.FirstOrDefault(a => a.Category() == questionCategory);
     if (question != null)
         return question.Name();
     throw new NullReferenceException();
 }
Example #26
0
 /// <summary>
 /// Adds the specified category.
 /// </summary>
 /// <param name="category">The category.</param>
 public static void Add(QuestionCategory category)
 {
     using (var context = new Entities())
     {
         context.QuestionCategories.Add(category);
         context.SaveChanges();
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            QuestionCategory questionCategory = db.QuestionCategorys.Find(id);

            db.QuestionCategorys.Remove(questionCategory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // TODO Check for duplicate?
        public bool AddCategoryToQuestion(QuestionCategory qCategory)
        {
            qCategory.Id = Guid.NewGuid().ToString();
            var category = _repo.GetById(qCategory.CategoryId);
            var success  = _repo.AddCategoryToQuestion(qCategory);

            return(success);
        }
        private HonoplayDbContext InitAndGetDbContext(out Guid tenantId)
        {
            var context = GetDbContext();
            var salt    = ByteArrayExtensions.GetRandomSalt();

            var adminUser = new AdminUser
            {
                Id           = 1,
                Email        = "*****@*****.**",
                Password     = "******".GetSHA512(salt),
                PasswordSalt = salt,
                LastPasswordChangeDateTime = DateTimeOffset.Now.AddDays(-5)
            };

            context.AdminUsers.Add(adminUser);


            var tenant = new Tenant
            {
                Name      = "testTenant",
                HostName  = "localhost",
                CreatedBy = adminUser.Id
            };

            context.Tenants.Add(tenant);

            context.TenantAdminUsers.Add(new TenantAdminUser
            {
                TenantId    = tenant.Id,
                AdminUserId = adminUser.Id,
                CreatedBy   = adminUser.Id
            });

            var question = new Question
            {
                Duration  = 3,
                Text      = "testQuestion",
                CreatedBy = adminUser.Id,
                TenantId  = tenant.Id
            };

            context.Questions.Add(question);

            var questionCategory = new QuestionCategory
            {
                Id        = 1,
                CreatedBy = adminUser.Id,
                Name      = "questionCategory1",

                TenantId = tenant.Id
            };

            context.QuestionCategories.Add(questionCategory);

            tenantId = tenant.Id;
            context.SaveChanges();
            return(context);
        }
Example #30
0
        private static void Main(string[] args)
        {
            if (!categories.Any(s => s.CategoryUserFriendlyName == "custom"))
            {
                var core = new QuestionCategory();
                core.CategoryUserFriendlyName = "custom";
                core.UniquePath = "\\custom";
                translations.LessonDesc.Add("\\custom\tPytania Niestandartowe\tCustom Tasks\tНестандартные вопросы");
                categories[0].SubcategoriesUniquePaths.Add("\\custom");
                categories.Add(core);
            }
            customs = categories.Find(s => s.CategoryUserFriendlyName == "custom");
            while (true)
            {
                Console.WriteLine("Wybierz akcje:");
                Console.WriteLine("1. Dodaj Pytanie");
                Console.WriteLine("2. Usun pytanie");
                Console.WriteLine("3. Edytuj pytanie");
                Console.WriteLine("4. Exportuj pytanie");
                Console.WriteLine("5. Usuń katagorię");
                Console.WriteLine("6. Exportuj lekcję");
                Console.WriteLine("7. Inportuj lekcję");
                switch (Console.ReadLine())
                {
                case "1":
                    Case1();
                    break;

                case "2":
                    Case2();
                    break;

                case "3":
                    Case3();
                    break;

                case "4":
                    Case4();
                    break;

                case "5":
                    Case5();
                    break;

                case "6":
                    Case6();
                    break;

                case "7":
                    Case7();
                    break;
                }

                BinarySerializer.Serialize(AppDomain.CurrentDomain.BaseDirectory + "_Data\\categories.bin", categories);
                BinarySerializer.Serialize(AppDomain.CurrentDomain.BaseDirectory + "_Data\\questions.bin", questions);
                translations.Save();
            }
        }
 public IActionResult PostQuestionCategory([FromBody] QuestionCategory questionCategory)
 {
     if (questionCategory == null)
     {
         return(BadRequest("QuestionCategory is null !!!"));
     }
     _dataRepository.Add(questionCategory);
     return(CreatedAtRoute("GetQCat", new { Id = questionCategory.QuestionCategoryId }, questionCategory));
 }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            QuestionCategory questionCategory = await db.QuestionCategories.FindAsync(id);

            db.QuestionCategories.Remove(questionCategory);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Example #33
0
        public async Task <IActionResult> PostCategory([FromBody] QuestionCategory qc)
        {
            qc.CreationDate = DateTime.Now;
            await _context.QuestionCategories.AddAsync(qc);

            await _context.SaveChangesAsync();

            return(Ok(_context.QuestionCategories));
        }
Example #34
0
        private static ScoreCardCategoryScore CalculateScoreForCategory(IEnumerable<ValuationQuestionScore> questionScores, QuestionCategory questionCategory)
        {
            var categoryScores = questionScores.Where(q => q.Question.Category == questionCategory).ToList();

            return new ScoreCardCategoryScore
            {
                TotalScore = categoryScores.Sum(c => (int)c.Score),
                AverageScore = categoryScores.Sum(c => (float)c.Score) / categoryScores.Count()
            };
        }
Example #35
0
 public ScoreCardCategoryScore this[QuestionCategory questionCategory]
 {
     get
     {
         switch (questionCategory)
         {
             case QuestionCategory.Valuation:
                 return this.ValuationScore;
             default:
                 throw new ArgumentOutOfRangeException(nameof(questionCategory));
         }
     }
 }
Example #36
0
 public ScoreCardCategoryScore this[QuestionCategory questionCategory]
 {
     get
     {
         switch (questionCategory)
         {
             case QuestionCategory.EditorialInformation:
                 return this.EditorialInformationScore;
             case QuestionCategory.PeerReview:
                 return this.PeerReviewScore;
             case QuestionCategory.Governance:
                 return this.GovernanceScore;
             case QuestionCategory.Process:
                 return this.ProcessScore;
             case QuestionCategory.Valuation:
                 return this.ValuationScore;
             default:
                 throw new ArgumentOutOfRangeException(nameof(questionCategory));
         }
     }
 }
 public void get_category_name_by_location(int location, QuestionCategory category)
 {
     Assert.That(_questions.GetCategoryBy(location), Is.EqualTo(category));
 }
Example #38
0
 public void LoadQuestion(QuestionCategory category)
 {
     //if (CurrentTeam.IsHardQuestion)
     //    LoadQuestion(category, QuestionDifficulty.Hard);
     //else
     //    LoadQuestion(category, QuestionDifficulty.Normal);
     CurrentQuestion = questionBank.GetQuestion(category, QuestionDifficulty.Normal);
 }
Example #39
0
 public Question(QuestionCategory category, string name)
 {
     _category = category;
     _name = name;
 }
Example #40
0
 public Question(int id, string description, QuestionCategory category)
 {
     Id = id;
     Description = description;
     Category = category;
 }
Example #41
0
 public void LoadQuestion(QuestionCategory category, QuestionDifficulty difficulty)
 {
     CurrentQuestion = questionBank.GetQuestion(category, difficulty);
 }
Example #42
0
        public Question GetQuestion(QuestionCategory category, QuestionDifficulty difficulty)
        {
            #region Obsolete
            /*if (category == QuestionCategory.Red)
                return new Question()
                {
                    QuestionContent = "Red " + difficulty.ToString() + ": How to design this screen??? How to design this screen??? How to design this screen???",
                    A = "Dunno lah",
                    B = "How can I know",
                    C = "No idea",
                    D = "Why have to design??? Hehehe",
                    CorrectAnswer = "A"
                };
            else if (category == QuestionCategory.Blue)
                return new Question()
                {
                    QuestionContent = "Blue " + difficulty.ToString() + ": Test",
                    A = "A",
                    B = "B",
                    C = "C",
                    D = "D",
                    CorrectAnswer = "A"
                };
            else if (category == QuestionCategory.Green)
                return new Question()
                {
                    QuestionContent = "Green " + difficulty.ToString() + ": Test",
                    A = "A",
                    B = "B",
                    C = "C",
                    D = "D",
                    CorrectAnswer = "B"
                };
            else if (category == QuestionCategory.Yellow)
                return new Question()
                {
                    QuestionContent = "Yellow " + difficulty.ToString() + ": Test",
                    A = "A",
                    B = "B",
                    C = "C",
                    D = "D",
                    CorrectAnswer = "C"
                };
            else if (category == QuestionCategory.Gray)
                return new Question()
                {
                    QuestionContent = "Gray Normal: Test",
                    A = "A",
                    B = "B",
                    C = "C",
                    D = "D",
                    CorrectAnswer = "D"
                };
            else
                return null;*/
            #endregion

            #region Multiple Categories [Obsolete]
            //string queueName = string.Format("queue" + category.ToString() + difficulty.ToString());
            //try
            //{
            //    if (queueName == "queueRedNormal")
            //        return queueRedNormal.Dequeue();
            //    else if (queueName == "queueRedHard")
            //        return queueRedHard.Dequeue();
            //    else if (queueName == "queueBlueNormal")
            //        return queueBlueNormal.Dequeue();
            //    else if (queueName == "queueBlueHard")
            //        return queueBlueHard.Dequeue();
            //    else if (queueName == "queueYellowNormal")
            //        return queueYellowNormal.Dequeue();
            //    else if (queueName == "queueYellowHard")
            //        return queueYellowHard.Dequeue();
            //    else if (queueName == "queueGreenNormal")
            //        return queueGreenNormal.Dequeue();
            //    else if (queueName == "queueGreenHard")
            //        return queueGreenHard.Dequeue();
            //    else if (queueName == "queueGrayNormal")
            //        return queueGrayNormal.Dequeue();
            //    else if (queueName == "queueGrayHard")
            //        return queueGrayHard.Dequeue();
            //    else
            //        return null;
            //}
            //catch(Exception e)
            //{
            //    Debug.WriteLine(e.Message);
            //    return null;
            //}
            #endregion

            #region Multiple Difficulties
            try
            {
                if (difficulty == QuestionDifficulty.Normal)
                    return queueNormal.Dequeue();
                else
                    return queueHard.Dequeue();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                return null;
            }
            #endregion

            //try
            //{
            //    return queueQuestion.Dequeue();
            //}
            //catch (Exception e)
            //{
            //    Debug.WriteLine(e.Message);
            //    return null;
            //}
        }
Example #43
0
 public void return_friendly_string_representation(QuestionCategory questionCategory, string category)
 {
     Assert.That(questionCategory.GetDescription(), Is.EqualTo(category));
 }