public void EditQuestionAnswerValidFirstNullLast() { Question question = new Question(QuestionUtility.GetGenericQuestion()); Assert.Throws <ArgumentNullException>(delegate { question.AddAnswers("20", null); }); }
public void EditQuestionAnswersAddNull() { Question question = new Question(QuestionUtility.GetGenericQuestion()); Assert.Throws <ArgumentNullException>(delegate { question.AddAnswers(null); }); }
public void EditQuestionAnswersAddDatabase() { 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.AddAnswers("200"); Question result2 = api.EditQuestion(result.ID, question); Assert.AreNotEqual(result.Answers, result2.Answers); }
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); }
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); }
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); }