예제 #1
0
        public void ConstructorShouldCreateValidTimedQuestionWhenValidParametersAreProvided()
        {
            var text     = "QuestionText";
            var question = new TimedQuestion(text, DifficultyLevel.Easy, CategoryType.Geography, 10);

            Assert.IsInstanceOfType(question, typeof(IQuestion));
        }
예제 #2
0
        public void TimedQuestionTimeGetterShouldCorrectTimeWhenValidParametersAreProvidedToTheConstructor()
        {
            var text = "QuestionText";
            var time = 10;

            var question = new TimedQuestion(text, DifficultyLevel.Easy, CategoryType.Geography, time);

            Assert.AreEqual(time, question.Time);
        }
        private void DisplayQuestionType()
        {
            switch (engine.QuizzardQuestions[countQuestions].QuestionType)
            {
            case QuestionType.Normal:
                BonusType.Visibility    = Visibility.Hidden;
                BonusPoints.Visibility  = Visibility.Hidden;
                TimeType.Visibility     = Visibility.Hidden;
                SecondsTimer.Visibility = Visibility.Hidden;
                break;

            case QuestionType.Timed:
                TimeType.Visibility     = Visibility.Visible;
                SecondsTimer.Visibility = Visibility.Visible;

                TimedQuestion timeQuestion = engine.QuizzardQuestions[countQuestions] as TimedQuestion;
                this.timer        = timeQuestion.Time;
                SecondsTimer.Text = this.timer.ToString();

                this.dispatcherTimer          = new DispatcherTimer();
                this.dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
                this.dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
                this.dispatcherTimer.Start();

                BonusType.Visibility   = Visibility.Hidden;
                BonusPoints.Visibility = Visibility.Hidden;
                break;

            case QuestionType.Bonus:
                BonusType.Visibility = Visibility.Visible;
                BonusQuestion bonusQuestion = engine.QuizzardQuestions[countQuestions] as BonusQuestion;
                BonusPoints.Text       = $"x{bonusQuestion.PointsMultiplier}";
                BonusPoints.Visibility = Visibility.Visible;

                TimeType.Visibility     = Visibility.Hidden;
                SecondsTimer.Visibility = Visibility.Hidden;
                break;

            default:
                break;
            }
        }