コード例 #1
0
 public void authorTest()
 {
     QuizQuestion target = new QuizQuestion(); // TODO: Initialize to an appropriate value
     string expected = string.Empty; // TODO: Initialize to an appropriate value
     string actual;
     target.author = expected;
     actual = target.author;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
コード例 #2
0
 private void CreateQuizQuestion(object sender)
 {
     var creationTimeAndId = SandRibbonObjects.DateTimeFactory.Now().Ticks;
     var quiz = new QuizQuestion(creationTimeAndId, creationTimeAndId, "Unused", Globals.me, question.Text, new List<Option>());
     quiz.Url = identity;
     foreach (object obj in quizQuestions.Items)
     {
         var answer = (Option)obj;
         if (!string.IsNullOrEmpty(answer.optionText))
             quiz.Options.Add(answer);
     }
     Commands.SendQuiz.ExecuteAsync(quiz);
     App.auditor.trace("CreatedPollQuestion {0}", question.Text);
     this.Close();
 }
 public void receiveQuiz(QuizQuestion qq) { }
コード例 #4
0
        public ViewEditAQuiz(QuizQuestion thisQuiz)
        {
            Dispatcher.adopt(delegate
            {
                DataContext = thisQuiz;

                InitializeComponent();
                var closeCommand = new DelegateCommand<object>((_unused) => { Close(); });
                this.Loaded += (s, e) =>
                {
                    Commands.JoinConversation.RegisterCommand(closeCommand);
                    Commands.ShowConversationSearchBox.RegisterCommand(closeCommand);
                };
                this.Unloaded += (s, e) =>
                {
                    Commands.JoinConversation.UnregisterCommand(closeCommand);
                    Commands.ShowConversationSearchBox.UnregisterCommand(closeCommand);
                };
                question.Options.CollectionChanged += UpdateOptionError;
                //QuestionError = false;
                ResultsExist = CheckResultsExist(question);
            });
        }
コード例 #5
0
        private bool ValidQuiz(QuizQuestion editedQuiz)
        {
            var questionError = false;
            var optionError = false;
            var questionValid = question.Validate(out questionError, out optionError);
            QuestionError = questionError;
            OptionError = optionError;

            return questionValid;
        }
コード例 #6
0
 public bool CheckResultsExist(QuizQuestion quizQuestion)
 {
     return Globals.quiz.answers.FirstOrDefault(answer => answer.Key == quizQuestion.Id).Value.Count > 0;
 }
コード例 #7
0
ファイル: Client.cs プロジェクト: StackableRegiments/metl2011
 public void SendQuizQuestion(QuizQuestion qq)
 {
     Trace.TraceInformation("Beginning QuizQuestion send: " + qq.id);
     Action work = delegate
     {
         wire.SendQuiz(qq);
     };
     tryIfConnected(work);
 }
コード例 #8
0
        public void EndEdit()
        {
            foreach (var option in Options)
            {
                option.EndEdit();
            }

            _cachedCopy = null;
            IsInEditMode = false;
        }
コード例 #9
0
 private void ReceiveQuiz(QuizQuestion quiz)
 {
     Dispatcher.adoptAsync(() =>
     {
         int oldQuizIndex = -1;
         if (Globals.quiz.activeQuizzes.Any(q => q.Id == quiz.Id))
         {
             List<QuizQuestion> oldQuizzes = Globals.quiz.activeQuizzes.Where(q => q.Id == quiz.Id).ToList();
             QuizQuestion oldQuiz = oldQuizzes.First();
             if (quiz.Created >= oldQuiz.Created)
             {
                 oldQuizIndex = Globals.quiz.activeQuizzes.IndexOf(oldQuiz);
                 foreach (var q in oldQuizzes)
                 {
                     Globals.quiz.activeQuizzes.Remove(q);
                 }
             }
         }
         if (!Globals.quiz.answers.ContainsKey(quiz.Id))
             Globals.quiz.answers[quiz.Id] = new ObservableCollection<QuizAnswer>();
         if (!quiz.IsDeleted)
         {
             if (oldQuizIndex == -1)
                 Globals.quiz.activeQuizzes.Add(quiz);
             else
                 Globals.quiz.activeQuizzes.Insert(oldQuizIndex, quiz);
         }
         // force the UI to update the labels. this is horrible
         var tempQuizzes = new List<QuizQuestion>();
         tempQuizzes.AddRange(Globals.quiz.activeQuizzes);
         Globals.quiz.activeQuizzes.Clear();
         foreach (var reindexQuiz in tempQuizzes)
         {
             Globals.quiz.activeQuizzes.Add(reindexQuiz);
         }
         quizzes.ScrollToEnd();
     });
 }
コード例 #10
0
        public QuizQuestion DeepCopy()
        {
            var quizQuestion = new QuizQuestion(Id, Title, Author, Question, new List<Option>());
            quizQuestion.IsDeleted = IsDeleted;
            quizQuestion.Url = Url;
            quizQuestion.Created = Created;
            foreach (var option in Options)
            {
                quizQuestion.Options.Add(option.DeepCopy());
            }

            return quizQuestion;
        }
コード例 #11
0
 public QuizInfo(QuizQuestion question, List<QuizAnswer> answers )
 {
     Question = question;
     Answers = answers;
 }
コード例 #12
0
 public void QuizQuestionConstructorTest()
 {
     QuizQuestion target = new QuizQuestion();
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
コード例 #13
0
 public void optionsTest()
 {
     QuizQuestion target = new QuizQuestion(); // TODO: Initialize to an appropriate value
     List<Option> expected = null; // TODO: Initialize to an appropriate value
     List<Option> actual;
     target.options = expected;
     actual = target.options;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
コード例 #14
0
 void IReceiveEvents.receiveQuiz(QuizQuestion qq)
 {
     QuizQuestionAvailable(this, new QuizQuestionAvailableEventArgs { quizQuestion = qq });
 }
コード例 #15
0
 public Quiz(QuizQuestion parameters)
     : this()
 {
     this.parameters = parameters;
 }
コード例 #16
0
        public void BeginEdit()
        {
            _cachedCopy = DeepCopy();

            IsInEditMode = true;

            foreach (var option in Options)
            {
                option.BeginEdit();
            }
        }
コード例 #17
0
 private void SendQuiz(QuizQuestion qq)
 {
     client.SendQuizQuestion(qq, Globals.conversationDetails.Jid);
 }
コード例 #18
0
        private void receiveQuiz(QuizQuestion details)
        {

        }