public void TestListCount()
        {
            AnswerVM answervm = new AnswerVM();
            answervm.Text = "Hello";

            //QUESTION LIST IN QUIZVM
            QuestionVM questionvm = new QuestionVM();
            questionvm.Text = "Hello";
            questionvm.AnswerList = new ObservableCollection<AnswerVM>();
            questionvm.AnswerList.Add(answervm);
            questionvm.AnswerText = answervm.Text;

            QuizVM quizvm = new QuizVM();
            quizvm.QuestionList = new ObservableCollection<QuestionVM>();
            quizvm.QuestionList.Add(questionvm);
            quizvm.QuestionText = questionvm.Text;

            //ASSERTS FOR QUESTIONLIST
            Assert.AreEqual(1, quizvm.QuestionList.Count);
            Assert.AreNotEqual(0, quizvm.QuestionList.Count);
            Assert.ReferenceEquals(questionvm, quizvm.QuestionList.GetType());
            Assert.AreEqual("Hello", quizvm.QuestionText);

            //ASSERTS FOR ANSWERLIST
            Assert.AreEqual(1, questionvm.AnswerList.Count);
            Assert.AreNotEqual(0, questionvm.AnswerList.Count);
            Assert.ReferenceEquals(questionvm, questionvm.AnswerList.GetType());
            Assert.AreEqual("Hello", questionvm.AnswerText);
        }
        public void TestToPOCOS()
        {
            QuestionVM qvm = new QuestionVM();
            QuizVM quizvm = new QuizVM();
            AnswerVM answervm = new AnswerVM();

            Assert.ReferenceEquals(qvm, qvm.ToPOCO());
            Assert.ReferenceEquals(quizvm, quizvm.ToPOCO());
            Assert.ReferenceEquals(answervm, answervm.ToPoco());
        }
        public void TestTextProperties()
        {
            QuestionVM qvm = new QuestionVM();
            qvm.AnswerText = "Hello";
            qvm.Text = "Hello2";

            QuizVM quizvm = new QuizVM();
            quizvm.Name = "TestQuizName";
            quizvm.QuestionText = qvm.Text;

            Assert.AreEqual("Hello", qvm.AnswerText);
            Assert.AreEqual("Hello2", qvm.Text);

            Assert.AreEqual(qvm.Text, quizvm.QuestionText);
            Assert.AreEqual("TestQuizName", quizvm.Name);
        }
예제 #4
0
        public void GetQuestionList(QuizVM qvm)
        {
            int QuizID = qvm.Id;
            _quizName = qvm.Name;
            _amountOfQuestions = qvm.QuestionList.Count;

            GetAllQuestions(QuizID);
            GetAllAnswers();
        }
 public void AddQuiz()
 {
     window = new AddQuiz();
     SelectedQuiz = new QuizVM();
     RaisePropertyChanged("SelectedQuiz");
     window.Show();
 }