WordCount扩展

 合作者 201631062330 自己 201631062131

码云地址 https://gitee.com/ggtc/wordcount_extension.git

正文

1.静态代码检查情况

1.1检查工具:stylecop

1.2检查的模块名称及检查结果

1.2.1ClassWordCount.cs(统计单词数)

1.2.2ClassCountDeal.cs(统计调度模块)

1.2.3ClasssCharCount.cs(字符统计模块)

1.2.4CountAll.cs(统计指定目录统计模块)

 

 

1.2.5OutClass.cs(输出模块)

 

 

1.2.6Program.cs(主模块)

 

 

1.3分析

  1. 空格问题,等式两边,||两边,等未添加分号
  2. 注释问题,期望使用可生成XMl的注释

 2模块简介

在不修改现有模块的基础上,为系统新增一个模块,CountAll.cs(统计指定目录统计模块),以统计指定目录下所有文件,最后将模块

集成到系统,在统计管理模块调用此模块。本模块由三个小功能组成。

统计指定目录下的所有文件;

调用上一个功能,统计指定文件夹下所有子文件夹中的文件(并未实现递归调用);

对前两个功能的调用,并输出数据到模块外。

3单元测试情况

3.1负责的模块名称:

CountAll.cs(统计指定目录统计模块)

3.2设计测试用例采用的方法及思路

按照要求,使用TDD思想,先写好了测试代码,再根据测试代码实现具体函数,直到最终通过所有测试用例。

对于每个函数的测试用例,采用等价类划分法。具体代码如下:

public class ProgramTest
    {
        [TestMethod]
        public void CountAllFileTest()
        {
            InterfaceCountAllable i = new CountAll();
            //判断输出结果不为空
            Assert.IsNotNull(i.CountAllFile("D:\\新建文件夹 (2)"));
            //判断输出结果为空
            Assert.IsNull(i.CountAllFile("F:\\"));
        }

        [TestMethod]
        public void FileExistTest()
        {
            InterfaceCountAllable i = new CountAll();
            //判断目录下存在文件
            Assert.IsTrue(i.FileExist("D:\\新建文件夹 (2)"),"存在");
            //判断目录下不存在文件
            Assert.IsFalse(i.FileExist("D:\\新建文件夹 (4)"),"不存在");
        }

        [TestMethod]
        public void DicExistTest()
        {
            InterfaceCountAllable i = new CountAll();
            //判断目录下存在文件夹
            Assert.IsTrue(i.DicExist("D:\\"), "存在");
            //判断目录下不存在文件夹
            Assert.IsFalse(i.DicExist("D:\\新建文件夹"), "不存在");
        }

        [TestMethod]
        public void CountAllDicTest()
        {
            InterfaceCountAllable i = new CountAll();
            //判断输出结果不为空
            Assert.IsNotNull(i.CountAllDic("D:\\素材"), "不为空");
            //判断输出结果为空
            Assert.IsNull(i.CountAllDic("D:\\新建文件夹"), "为空");
        }

        [TestMethod]
        public void Count()
        {
            InterfaceCountAllable i = new CountAll();
            //判断输出结果不为空
            Assert.IsNotNull(i.Count("D:\\素材"), "不为空");
            //判断输出结果为空
            Assert.IsNull(i.Count("D:\\新建文件夹"), "为空");
        }
    }
View Code

 

posted @ 2018-10-21 20:37  ggtc  阅读(233)  评论(0编辑  收藏  举报