Exemplo n.º 1
0
        public void TestGetWordListLength()
        {
            DictionaryModel file = new DictionaryModel();
            List <Word>     data = new List <Word>();

            data = file.ReadFile(ConstantWord.TEST_ONE);
            Assert.AreEqual(data.Count, ConstantWord.EIGHT);
        }
Exemplo n.º 2
0
        public void TestCutLine()
        {
            DictionaryModel file = new DictionaryModel();
            List <Word>     data = new List <Word>();

            data = file.ReadFile(ConstantWord.TEST_ONE);
            Assert.AreEqual(data[ConstantWord.ZERO].GetEnglish(), ConstantWord.TEST_ENGLISH_1);
            Assert.AreEqual(data[ConstantWord.ZERO].GetChinese(), ConstantWord.TEST_CHINESE_1);
            Assert.AreEqual(data[ConstantWord.FIVE].GetEnglish(), ConstantWord.TEST_ENGLISH_2);
            Assert.AreEqual(data[ConstantWord.FIVE].GetChinese(), ConstantWord.TEST_CHINESE_2);
        }
Exemplo n.º 3
0
 public void TestIsSomeWord()
 {
     _dictionaryModel = new DictionaryModel();
     _word            = new Word(ConstantWord.CHINESE, ConstantWord.ENGLISH);
     _dictionaryModel = new DictionaryModel();
     _dictionaryModel.ReadFile(ConstantWord.ENGLISH_WORD);
     _question = new Question(_word, _dictionaryModel);
     _question.SetOptionList();
     _question.IsSomeWord(ConstantWord.ZERO, ConstantWord.CHINESE_A);
     _question.SetOptionList();
     _question.IsSomeWord(ConstantWord.ZERO, ConstantWord.CHINESE_AGAIN);
 }
Exemplo n.º 4
0
        public void TestCreateQueenOption()
        {
            _dictionaryModel = new DictionaryModel();
            _word            = new Word(ConstantWord.CHINESE, ConstantWord.ENGLISH);
            _dictionaryModel = new DictionaryModel();
            _dictionaryModel.ReadFile(ConstantWord.ENGLISH_WORD);
            _question = new Question(_word, _dictionaryModel);
            int temp = _question.CreateQueenOption(ConstantWord.ZERO);

            Assert.AreEqual(temp, ConstantWord.ZERO);
            temp = _question.CreateQueenOption(ConstantWord.ONE);
            Assert.AreEqual(temp, ConstantWord.ONE);
            temp = _question.CreateQueenOption(ConstantWord.TWO);
            Assert.AreEqual(temp, ConstantWord.TWO);
        }
Exemplo n.º 5
0
        public void TestReadFile()
        {
            List <Word>     data1 = new List <Word>();
            DictionaryModel file1 = new DictionaryModel();

            data1 = file1.ReadFile(ConstantWord.TEST_ONE);
            Assert.AreEqual(data1[ConstantWord.ZERO].GetEnglish(), ConstantWord.TEST_ENGLISH_1);
            Assert.AreEqual(data1[ConstantWord.ZERO].GetChinese(), ConstantWord.TEST_CHINESE_1);
            Assert.AreEqual(data1[ConstantWord.FIVE].GetEnglish(), ConstantWord.TEST_ENGLISH_2);
            Assert.AreEqual(data1[ConstantWord.FIVE].GetChinese(), ConstantWord.TEST_CHINESE_2);
            DictionaryModel file2 = new DictionaryModel();
            List <Word>     data2 = new List <Word>();

            data2 = file2.ReadFile(ConstantWord.TEST_TWO);
            Assert.AreEqual(data2.Count, ConstantWord.FIVE);
            DictionaryModel file3 = new DictionaryModel();
            List <Word>     data3 = new List <Word>();

            data3 = file3.ReadFile(ConstantWord.TEST_THREE);
            Assert.AreEqual(data3.Count, ConstantWord.ZERO);
        }