コード例 #1
0
        public void TrueFalseQuestionTest()
        {
            TrueFalseQuestion q = new TrueFalseQuestion("Titre", "Texte", "FeedBack", true);

            //
            Assert.AreEqual(QuestionType.TrueFalse, q.Type);
            Assert.AreEqual("Titre", q.Name);
            Assert.AreEqual("Texte", q.QuestionText);
            Assert.AreEqual("FeedBack", q.GeneralFeedback);
            Assert.AreEqual(true, q.Correct);
            //
            Action action = () => q.AddAnswer("true", "aucune", 100);

            Assert.ThrowsException <OverflowException>(action);
            //
        }
コード例 #2
0
        public void TrueFalseQuestionTest1()
        {
            TrueFalseQuestion q = new TrueFalseQuestion("Titre", "Texte", "FeedBack", true, "Feedback Vrai", "Feedback Faux");

            //
            Assert.AreEqual(QuestionType.TrueFalse, q.Type);
            Assert.AreEqual("Titre", q.Name);
            Assert.AreEqual("Texte", q.QuestionText);
            Assert.AreEqual("FeedBack", q.GeneralFeedback);
            Assert.AreEqual("Feedback Vrai", q.FeedbackTrue);
            Assert.AreEqual("Feedback Faux", q.FeedbackFalse);
            Assert.AreEqual(true, q.Correct);
            //
            Action    action = () => q.AddAnswer("true", "aucune", 100);
            Exception exc    = Assert.ThrowsException <OverflowException>(action);

            //
            Trace.WriteLine(q.MoodleXML.OuterXml);
        }