public void GetWordTest()
 {
     Dictionary target = new Dictionary(); // TODO: 初始化為適當值
     target.LoadWords("../../../Dictionary2000.txt");
     int index = 34; // TODO: 初始化為適當值
     Word actual;
     actual = target.GetWord(index);
     Assert.AreEqual("[動詞] 同意",actual.Chinese);
     Assert.AreEqual("agree", actual.English);
 }
 public void GetAnswerTest()
 {
     Dictionary questionLibrary = new Dictionary(); // TODO: 初始化為適當值
     SelectionQuestion_Accessor target = new SelectionQuestion_Accessor(questionLibrary); // TODO: 初始化為適當值
     string expected1 = "accept"; // TODO: 初始化為適當值
     string expected2 = "[動詞] 接受";
     questionLibrary.LoadWords("dictionary2000.txt");
     target._testedVocabulary = questionLibrary.GetWord(10);
     target._isChineseSelection = false;
     string actual;
     actual = target.Answer;
     Assert.AreEqual(expected1, actual);
     target._isChineseSelection = true;
     actual = target.Answer;
     Assert.AreEqual(expected2, actual);
 }
Example #3
0
        /// <summary>
        /// Metoda wstawia kostki w odpowiednie miejsce na planszy i usuwa je z tabliczki gracza
        /// </summary>
        /// <param name="Container"></param>
        /// <param name="StartCell"></param>
        /// <param name="Word"></param>
        /// <param name="Rack"></param>
        public void PutTiles(Container Container, int StartIndex, Dictionary.Dictionary.WordFound Word, Rack Rack)
        {
            String NewWord = Word.GetWord();

            for(int i = 0; i < NewWord.Length; ++i)
            {
                Cell TempCell = Container.Get(StartIndex + i);

                if(!TempCell.IsVisited())
                {
                    TempCell.SetTile(Rack.Contains(NewWord[i]) ? new Tile(NewWord[i]) : new Tile(NewWord[i], true));

                    Rack.Remove(NewWord[i]);
                }
            }
        }
        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));

            }
        }
 public void SelectionTest()
 {
     Dictionary questionLibrary = new Dictionary(); // TODO: 初始化為適當值
     SelectionQuestion_Accessor target = new SelectionQuestion_Accessor(questionLibrary); // TODO: 初始化為適當值
     questionLibrary.LoadWords("dictionary2000.txt");
     target.CreateNewQuestion();
     List<int> actual;
     actual = target.Selection;
     Assert.AreEqual(4, actual.Count);
     int index = -1;
     for (int i = 0; i < questionLibrary.NumberOfVocabulary; i++)
     {
     if (questionLibrary.GetWord(i).English == target.Question)
     {
     index = i;
     break;
     }
     }
     Assert.AreEqual(true, target._selection.Contains(index));
     for (int i = 0; i < 3; i++)
     {
     for (int j = i+1; j < 4; j++)
     {
     Assert.AreNotEqual(target._selection[i], target._selection[j]);
     }
     }
 }
 public void GetQuestionTest()
 {
     Dictionary questionLibrary = new Dictionary(); // TODO: 初始化為適當值
     SelectionQuestion_Accessor target = new SelectionQuestion_Accessor(questionLibrary); // TODO: 初始化為適當值
     string expected = "accept"; // TODO: 初始化為適當值
     questionLibrary.LoadWords("dictionary2000.txt");
     target._testedVocabulary = questionLibrary.GetWord(10);
     string actual;
     actual = target.Question;
     Assert.AreEqual(expected, actual);
 }