コード例 #1
0
        public void AddOneSecondTest()
        {
            VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值

            target.RestTimer();
            target.AddOneSecond();
            Assert.AreEqual(target._second, 1);
            Assert.AreEqual(target._minute, 0);
            Assert.AreEqual(target._hour, 0);
            Assert.AreEqual(target.TimeText, "00:00:01");
            target.RestTimer();
            for (int i = 0; i < 61; i++)
            {
                target.AddOneSecond();
            }
            Assert.AreEqual(target._second, 1);
            Assert.AreEqual(target._minute, 1);
            Assert.AreEqual(target._hour, 0);
            Assert.AreEqual(target.TimeText, "00:01:01");
            target.RestTimer();
            for (int i = 0; i < 3743; i++)
            {
                target.AddOneSecond();
            }
            Assert.AreEqual(23, target._second);
            Assert.AreEqual(2, target._minute);
            Assert.AreEqual(1, target._hour);
            Assert.AreEqual(target.TimeText, "01:02:23");
        }
コード例 #2
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));
                }
            }
        }
コード例 #3
0
        public void GetCurrectTest()
        {
            VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
            int expected = 5;                                               // TODO: 初始化為適當值\

            target._correct = 5;
            int actual;

            actual = target.NumberOfCorrect;
            Assert.AreEqual(expected, actual);
        }
コード例 #4
0
        public void NumberOfQuestionTest()
        {
            VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
            int expected = 10;                                              // TODO: 初始化為適當值
            int actual;

            target._numberOfQuestion = 10;
            target.NumberOfQuestion  = expected;
            actual = target.NumberOfQuestion;
            Assert.AreEqual(expected, actual);
        }
コード例 #5
0
        public void GetNewFillQuestionTest()
        {
            VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值

            target.Initialize();
            string actual;

            actual = target.GetNewFillQuestion();
            string expected = target._fillQuestion.QuestionStatement;

            Assert.AreEqual(expected, actual);
        }
コード例 #6
0
 public void CaculateScoreTest()
 {
     VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
     target._correct = 5;
     target._numberOfQuestion = 20;
     target.CalculateScore();
     Assert.AreEqual((double)5 / (double)20 * (double)100, target._score);
     target._correct = 1;
     target._numberOfQuestion = 3;
     target.CalculateScore();
     Assert.AreEqual((double)1 / (double)3 * (double)100, target._score);
 }
コード例 #7
0
        public void CaculateScoreTest()
        {
            VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值

            target._correct          = 5;
            target._numberOfQuestion = 20;
            target.CalculateScore();
            Assert.AreEqual((double)5 / (double)20 * (double)100, target._score);
            target._correct          = 1;
            target._numberOfQuestion = 3;
            target.CalculateScore();
            Assert.AreEqual((double)1 / (double)3 * (double)100, target._score);
        }
コード例 #8
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);
        }
コード例 #9
0
        public void GetScoreTest()
        {
            VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值

            target._correct          = 20;
            target._numberOfQuestion = 25;
            target.CalculateScore();
            double expected = target._score;
            double actual;

            actual = target.Score;
            Assert.AreEqual(expected, actual);
        }
コード例 #10
0
        public void IsFillQuestionTest()
        {
            VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
            bool expected = false;                                          // TODO: 初始化為適當值
            bool actual;

            target._isFillQuestion = false;
            actual = target.IsFillQuestion;
            Assert.AreEqual(expected, actual);
            target._isFillQuestion = true;
            actual = target.IsFillQuestion;
            Assert.AreEqual(true, actual);
        }
コード例 #11
0
        public void IsEndOfQuestionTest()
        {
            VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
            bool expected = false;                                          // TODO: 初始化為適當值
            bool actual;

            target.NumberOfQuestion = 10;
            target._numberOfAnswer  = 5;
            actual = target.IsEndOfQuestion;
            Assert.AreEqual(expected, actual);
            target.NumberOfQuestion = 10;
            target._numberOfAnswer  = 10;
            actual = target.IsEndOfQuestion;
            Assert.AreEqual(true, actual);
        }
コード例 #12
0
        public void CreatQuestionTypeTest()
        {
            VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值

            target.Initialize();
            target.QuestionType = 0;
            target.CreateQuestionType();
            Assert.AreEqual(true, target._isFillQuestion);
            target.QuestionType = 1;
            target.CreateQuestionType();
            Assert.AreEqual(false, target._isFillQuestion);
            target.QuestionType = 2;
            target.CreateQuestionType();
            Assert.AreEqual(target.IsFillQuestion, target._isFillQuestion);
        }
コード例 #13
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);
        }
コード例 #14
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);
        }
コード例 #15
0
 public void AddOneSecondTest()
 {
     VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
     target.RestTimer();
     target.AddOneSecond();
     Assert.AreEqual(target._second, 1);
     Assert.AreEqual(target._minute, 0);
     Assert.AreEqual(target._hour, 0);
     Assert.AreEqual(target.TimeText, "00:00:01");
     target.RestTimer();
     for (int i = 0; i < 61; i++)
         target.AddOneSecond();
     Assert.AreEqual(target._second, 1);
     Assert.AreEqual(target._minute, 1);
     Assert.AreEqual(target._hour, 0);
     Assert.AreEqual(target.TimeText, "00:01:01");
     target.RestTimer();
     for (int i = 0; i < 3743; i++)
         target.AddOneSecond();
     Assert.AreEqual(23,target._second);
     Assert.AreEqual(2, target._minute);
     Assert.AreEqual(1,target._hour);
     Assert.AreEqual(target.TimeText, "01:02:23");
 }
コード例 #16
0
 public void NumberOfQuestionTest()
 {
     VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
     int expected = 10; // TODO: 初始化為適當值
     int actual;
     target._numberOfQuestion = 10;
     target.NumberOfQuestion = expected;
     actual = target.NumberOfQuestion;
     Assert.AreEqual(expected, actual);
 }
コード例 #17
0
 public void IsFillQuestionTest()
 {
     VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
     bool expected = false; // TODO: 初始化為適當值
     bool actual;
     target._isFillQuestion = false;
     actual = target.IsFillQuestion;
     Assert.AreEqual(expected, actual);
     target._isFillQuestion = true;
     actual = target.IsFillQuestion;
     Assert.AreEqual(true, actual);
 }
コード例 #18
0
 public void IsEndOfQuestionTest()
 {
     VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
     bool expected = false; // TODO: 初始化為適當值
     bool actual;
     target.NumberOfQuestion = 10;
     target._numberOfAnswer = 5;
     actual = target.IsEndOfQuestion;
     Assert.AreEqual(expected, actual);
     target.NumberOfQuestion = 10;
     target._numberOfAnswer = 10;
     actual = target.IsEndOfQuestion;
     Assert.AreEqual(true, actual);
 }
コード例 #19
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);
 }
コード例 #20
0
 public void GetScoreTest()
 {
     VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
     target._correct = 20;
     target._numberOfQuestion = 25;
     target.CalculateScore();
     double expected = target._score;
     double actual;
     actual = target.Score;
     Assert.AreEqual(expected, actual);
 }
コード例 #21
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);
 }
コード例 #22
0
 public void GetNewFillQuestionTest()
 {
     VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
     target.Initialize();
     string actual;
     actual = target.GetNewFillQuestion();
     string expected = target._fillQuestion.QuestionStatement;
     Assert.AreEqual(expected, actual);
 }
コード例 #23
0
 public void GetCurrectTest()
 {
     VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
     int expected = 5; // TODO: 初始化為適當值\
     target._correct = 5;
     int actual;
     actual = target.NumberOfCorrect;
     Assert.AreEqual(expected, actual);
 }
コード例 #24
0
 public void CreatQuestionTypeTest()
 {
     VocabularyMode_Accessor target = new VocabularyMode_Accessor(); // TODO: 初始化為適當值
     target.Initialize();
     target.QuestionType = 0;
     target.CreateQuestionType();
     Assert.AreEqual(true, target._isFillQuestion);
     target.QuestionType = 1;
     target.CreateQuestionType();
     Assert.AreEqual(false, target._isFillQuestion);
     target.QuestionType = 2;
     target.CreateQuestionType();
     Assert.AreEqual(target.IsFillQuestion, target._isFillQuestion);
 }
コード例 #25
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);
 }
コード例 #26
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));

            }
        }