Exemple #1
0
        public void EditQuestionCategoryAddNull()
        {
            Question question = new Question(QuestionUtility.GetGenericQuestion());

            Assert.Throws <ArgumentNullException>(delegate
            {
                question.AddCategories(null);
            });
        }
Exemple #2
0
        public void EditQuestionCategoryValidFirstNullLast()
        {
            Question question = new Question(QuestionUtility.GetGenericQuestion());

            Assert.Throws <ArgumentNullException>(delegate
            {
                question.AddCategories("basic", null);
            });
        }
Exemple #3
0
        public void QuestionToStringCompare()
        {
            Question question  = new Question(QuestionUtility.GetGenericQuestion());
            Question question2 = new Question(QuestionUtility.GetGenericQuestion());

            question2.AddCategories("generic");

            Assert.AreNotEqual(question.ToString(), question2.ToString());
        }
Exemple #4
0
        public void EditQuestionCategoriesAdd()
        {
            Question question = new Question(QuestionUtility.GetGenericQuestion());

            question.AddCategories("generic");

            Question question2 = new Question(QuestionUtility.GetGenericQuestion());

            question2.AddCategories("generic", "undefined");

            Assert.AreNotEqual(question.Categories, question2.Categories);
        }
Exemple #5
0
        public void TestURLConstructor()
        {
            API api = new API("http://localhost:8080/quizgame-backend", "api-test", "2fb5e13419fc89246865e7a324f476ec624e8740");

            Question question = new Question("Solve 4 + 4 * 4");

            question.AddCategories("basic");
            question.AddAnswers("16", "20", "24");
            api.AddQuestion(question);

            List <String> categories = api.GetCategories();

            Assert.AreNotEqual(categories, null);
        }
Exemple #6
0
        public void EditQuestionCategoriesAddDatabase()
        {
            API api = new API("api-test", "2fb5e13419fc89246865e7a324f476ec624e8740");

            Question question = new Question(QuestionUtility.GetGenericQuestion());

            Question result = api.AddQuestion(question);

            question.AddCategories("generic", "undefined");

            Question result2 = api.EditQuestion(result.ID, question);

            Assert.AreNotEqual(result.Categories, result2.Categories);
        }
Exemple #7
0
        public void EditQuestionAnswersAdd()
        {
            Question question = new Question("Solve 3 + 5 * 10");

            question.AddCategories("basic");
            question.AddAnswers("80", "53", "35");
            question.Correct = "53";

            Question question2 = new Question("Solve 3 + 5 * 10");

            question2.AddCategories("basic");
            question2.AddAnswers("80", "53", "35", "200");
            question2.Correct = "53";

            Assert.AreNotEqual(question.Answers, question2.Answers);
        }
Exemple #8
0
        public void GetQuestionsByCategory()
        {
            API api = new API("api-test", "2fb5e13419fc89246865e7a324f476ec624e8740");

            Question question = new Question("Solve a, where a + 4 = 11");

            question.AddCategories("basic", "algebra");
            question.AddAnswers("Undefined", "0", "-7", "7");
            question.Correct = "7";

            Question result = api.AddQuestion(question);

            List <Question> questions = api.GetQuestionsByCategory("algebra");

            Assert.AreNotEqual(questions, null);
        }
Exemple #9
0
        public void EditQuestionAnswersRemoveDatabase()
        {
            API api = new API("api-test", "2fb5e13419fc89246865e7a324f476ec624e8740");

            Question question = new Question("Solve 3 + 5 * 10");

            question.AddCategories("basic");
            question.AddAnswers("80", "53", "35");
            question.Correct = "53";

            Question result = api.AddQuestion(question);

            question.RemoveAnswers("80");

            Question result2 = api.EditQuestion(result.ID, question);

            Assert.AreNotEqual(result.Answers, result2.Answers);
        }