Esempio n. 1
0
        public void CountCharTest()
        {
            WordBasis.wordbasis = new WordBasis();
            int    Num = 12;//测试CountWord得到的结果字符数
            string a   = File.ReadAllText(@"D:\test2.txt");

            Assert.AreEqual(Num, WordBasis.CountWord(a));//测试CountWord得到的结果字符数是否符合要求
            string b = File.ReadAllText(@"C:\test3.txt");

            Assert.AreEqual(Num, WordBasis.CountWord(b));
        }
Esempio n. 2
0
        public void TestMethod1()
        {
            WordBasis.wordbasis = new WordBasis();
            string[] word = { "sada", "fewa", "reht", "tyyn" };//测试方法得到的结果单词字符长度是否超过规定的4
            string   a    = File.ReadAllText(@"D:\test.txt");

            for (int i = 0; i < 4; i++)
            {
                Assert.AreEqual(word[i], WordBasis.CountWord(a)[i]);
            }//测试CountWord方法得到的结果单词前四位是否都为字母
            string b = File.ReadAllText(@"D:\test1.txt");

            for (int i = 0; i < 4; i++)
            {
                Assert.AreEqual(word[i], WordBasis.CountWord(b)[i]);
            }
        }