public void WordConstructorTest() { string english = "Happy Dragon"; // TODO: 初始化為適當值 string chinese = "快樂龍"; // TODO: 初始化為適當值 Word target = new Word(english, chinese); Assert.AreEqual("Happy Dragon", target.English); Assert.AreEqual("快樂龍", target.Chinese); }
public void GetChineseTest() { string english = "Happy"; // TODO: 初始化為適當值 string chinese = "快樂"; // TODO: 初始化為適當值 Word target = new Word(english, chinese); // TODO: 初始化為適當值 string expected = "快樂"; // TODO: 初始化為適當值 string actual; actual = target.Chinese; Assert.AreEqual(expected, actual); }
public void GetEnglishTest() { string english = "Cat"; // TODO: 初始化為適當值 string chinese = "貓"; // TODO: 初始化為適當值 Word target = new Word(english, chinese); // TODO: 初始化為適當值 string expected = "Cat"; // TODO: 初始化為適當值 string actual; actual = target.English; Assert.AreEqual(expected, actual);; }
//產生填充題 public virtual void CreateNewQuestion() { int testLibraryIndex; //題庫索引位置 const string FIVE_BLANK = " "; //五個空格 bool continueFlag = true; do //取得新的題庫索引位置(尚未考過的) { testLibraryIndex = _randomValue.CreateRandomValue(0, _questionLibrary.NumberOfVocabulary); if (!_isTestedIndex.Contains(testLibraryIndex)) { _isTestedIndex.Add(testLibraryIndex); continueFlag = false; } } while (continueFlag); _testedVocabulary = _questionLibrary.GetWord(testLibraryIndex); //根據所以取得單字 int tipIndex = _randomValue.CreateRandomValue(1, _testedVocabulary.English.Length); //提示索引位置 _questionStatement = _testedVocabulary.Chinese + FIVE_BLANK; //將題目字串先加入中文 AddEnglishTipToQuetionStatement(tipIndex); }