惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Latest news
Latest news
T
The Exploit Database - CXSecurity.com
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
L
Lohrmann on Cybersecurity
aimingoo的专栏
aimingoo的专栏
B
Blog
T
Threat Research - Cisco Blogs
罗磊的独立博客
Application and Cybersecurity Blog
Application and Cybersecurity Blog
P
Proofpoint News Feed
P
Palo Alto Networks Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
宝玉的分享
宝玉的分享
博客园 - 司徒正美
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
T
Tor Project blog
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
酷 壳 – CoolShell
酷 壳 – CoolShell
Recorded Future
Recorded Future
D
DataBreaches.Net
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
IT之家
IT之家
B
Blog RSS Feed
Scott Helme
Scott Helme
P
Proofpoint News Feed
V
Vulnerabilities – Threatpost
A
Arctic Wolf
Help Net Security
Help Net Security
L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Vercel News
Vercel News
AWS News Blog
AWS News Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Schneier on Security
Hacker News: Ask HN
Hacker News: Ask HN
N
Netflix TechBlog - Medium
L
LangChain Blog
博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
M
MIT News - Artificial intelligence
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
W
WeLiveSecurity

博客园 - 稽首本然

Nhibernate 教程,有空看看 Jquery专题写的不少,有空看看,另该研究下门面模式了! Java开源权限管理中间件 《需求规格说明书》业务描述活动图 《需求规格说明书》(用例)陷阱 《需求规格说明书》核心功能表现方式(用例) LINQ TO SQL ScriptManager与UpdatePanel总结 一个关于NHiberante,Linq数据源与UI交互引发的思考 数据库联接字符串 LINQ TO OBJECT ASPX直接编写脚本function后使用javascript Aspx页面中直接编写javascript脚本 母版事件中注册javascript脚本 ASPNET跨页面传值技巧总结 javascript捣乱程序 Javascript在Asp.Net中的应用汇总 AjaxPanel中使用javascript AjaxPanel控件说明
Nunti测试工具使用整理
稽首本然 · 2011-02-09 · via 博客园 - 稽首本然

1.资源下载:

2.DotNet中使用

   先安装

   建立类库项目

   右键属性,选择调试

   在调试中,选择启动外部程序,选择Nunit.exe

   在调试中,选择工作目录

   完成后,F5将启动Nunit程序

3.

    [TestFixture]

   用于声明测试类,条件为Public

   [TestFixtureSetup]

   用于声明测试方法,最先执行1次

   [TestFixtureTearDown]

   用于声明测试方法,最后执行1次

   [Test]

   用于声明测试方法,条件为Public

   [Setup]

   用于声明测试方法,对应于[Test]有多少[Test]就执行多少次,在每个[Test]执行前执行

   [TearDown]

   同上,在每个[Test]执行后执行

   [Ingory("")]

   用语忽略部分不需要测试的方法 

   public void InitializeOperands() {//...}类似于初始化

   [Category("分组名")]用于对测试方法进行分组,方便于测试

4.相关代码

   [TestFixture] 
   public  class Nunit测试类 //Nunit测试的类必须是public类型的
    {
        public  Nunit测试类() { }
        private int a, b;
        [SetUp]
        public void InitializeOperands() //这个方法是Nunit固定的方法,必须记忆
        {
             a = 1;
             b = 2;
        }
        [Test]
        public void TestSum()
        {
           // int a = 1;//重复部分可,提取出来
            //int b = 2;//
            int sum = a + b;
            Assert.AreEqual(sum,3);
        }
        [Test]
        public void Multiply()
        {
            //int a = 1;//
            //int b = 2;//
            int result = a * b;
            Assert.AreEqual(result, 2);
        }
    }

5.参考资料

http://hi.baidu.com/grayworm/blog/item/009616601bba2fd98db10da4.html

6.各种断言

http://hi.baidu.com/grayworm/blog/item/4e741d2caacad8ea8a1399a0.html