Beispiel #1
0
        public void CreatNewSelectionQuestionTest()
        {
            VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
            Dictionary dictionary          = new Dictionary();

            target.Initialize();
            List <string> actual;

            dictionary.LoadWords("dictionary2000.txt");
            actual = target.CreateNewSelectionQuestion();
            if (target._selectionQuestion.IsChineseSelection)
            {
                for (int i = 0; i < 4; i++)
                {
                    Assert.AreEqual(true, actual.Contains(dictionary.GetWord(target._selectionQuestion.Selection[i]).Chinese));
                }
            }
            else
            {
                for (int i = 0; i < 4; i++)
                {
                    Assert.AreEqual(true, actual.Contains(dictionary.GetWord(target._selectionQuestion.Selection[i]).English));
                }
            }
        }
Beispiel #2
0
        public void CheckAnswerTest()
        {
            VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
            string actual;

            target.Initialize();
            target._isFillQuestion = true;
            target.GetNewFillQuestion();
            actual = target.CheckAnswer(target._fillQuestion.Answer, 0);
            Assert.AreEqual("Correct!!", actual);
            target.GetNewFillQuestion();
            actual = target.CheckAnswer("AlwaysFail", 0);
            Assert.AreEqual("It should be " + target._fillQuestion.Answer, actual);
            target._isFillQuestion = false;
            target.CreateNewSelectionQuestion();
            actual = target.CheckAnswer("", target._selectionAnswer);
            Assert.AreEqual("Correct!!", actual);
            target.CreateNewSelectionQuestion();
            actual = target.CheckAnswer("AlwaysFail", 0);
            Assert.AreEqual("It should be " + "(" + target._selectionAnswer.ToString() + ") " + target._selectionQuestion.Answer, actual);
        }
Beispiel #3
0
        public void InitializeTest()
        {
            VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值

            target.Initialize();
            target.CreateNewSelectionQuestion();
            target._isFillQuestion = false;
            target.CheckAnswer("HAHA", 0);
            target.Initialize();
            Assert.AreEqual(0, target._numberOfAnswer);
            Assert.AreEqual(0, target._correct);
            Assert.AreEqual(true, target._isFillQuestion);
        }
Beispiel #4
0
        public void GetNumberOfAnsweredTest()
        {
            VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
            int expected = 0;                                               // TODO: 初始化為適當值
            int actual;

            target.Initialize();
            actual = target.NumberOfAnswered;
            Assert.AreEqual(expected, actual);
            target._isFillQuestion = false;
            target.GetNewFillQuestion();
            target.CheckAnswer("HAHA", 0);
            actual = target.NumberOfAnswered;
            Assert.AreEqual(1, actual);
            target.CreateNewSelectionQuestion();
            target.CheckAnswer("NONO", 0);
            actual = target.NumberOfAnswered;
            Assert.AreEqual(2, actual);
        }
 public void CheckAnswerTest()
 {
     VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
     string actual;
     target.Initialize();
     target._isFillQuestion = true;
     target.GetNewFillQuestion();
     actual = target.CheckAnswer(target._fillQuestion.Answer,0);
     Assert.AreEqual("Correct!!", actual);
     target.GetNewFillQuestion();
     actual = target.CheckAnswer("AlwaysFail",0);
     Assert.AreEqual("It should be " + target._fillQuestion.Answer, actual);
     target._isFillQuestion = false;
     target.CreateNewSelectionQuestion();
     actual = target.CheckAnswer("",target._selectionAnswer);
     Assert.AreEqual("Correct!!", actual);
     target.CreateNewSelectionQuestion();
     actual = target.CheckAnswer("AlwaysFail",0);
     Assert.AreEqual("It should be " + "(" + target._selectionAnswer.ToString() + ") " + target._selectionQuestion.Answer, actual);
 }
 public void InitializeTest()
 {
     VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
     target.Initialize();
     target.CreateNewSelectionQuestion();
     target._isFillQuestion = false;
     target.CheckAnswer("HAHA",0);
     target.Initialize();
     Assert.AreEqual(0, target._numberOfAnswer);
     Assert.AreEqual(0, target._correct);
     Assert.AreEqual(true, target._isFillQuestion);
 }
 public void GetNumberOfAnsweredTest()
 {
     VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
     int expected = 0; // TODO: 初始化為適當值
     int actual;
     target.Initialize();
     actual = target.NumberOfAnswered;
     Assert.AreEqual(expected, actual);
     target._isFillQuestion = false;
     target.GetNewFillQuestion();
     target.CheckAnswer("HAHA",0);
     actual = target.NumberOfAnswered;
     Assert.AreEqual(1, actual);
     target.CreateNewSelectionQuestion();
     target.CheckAnswer("NONO",0);
     actual = target.NumberOfAnswered;
     Assert.AreEqual(2, actual);
 }
        public void CreatNewSelectionQuestionTest()
        {
            VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
            Dictionary dictionary = new Dictionary();
            target.Initialize();
            List<string> actual;
            dictionary.LoadWords("dictionary2000.txt");
            actual = target.CreateNewSelectionQuestion();
            if (target._selectionQuestion.IsChineseSelection)
            {
                for (int i = 0; i < 4; i++)
                    Assert.AreEqual(true, actual.Contains(dictionary.GetWord(target._selectionQuestion.Selection[i]).Chinese));
            }
            else
            {
                for (int i = 0; i < 4; i++)
                    Assert.AreEqual(true, actual.Contains(dictionary.GetWord(target._selectionQuestion.Selection[i]).English));

            }
        }