zoukankan      html  css  js  c++  java
  • 关于使用TestDriven.Net 2.0的一点补充

                               关于使用TestDriven.Net 2.0的一点补充
                                                          电子科技大学软件学院03级02班 周银辉

         2006.12的<程序员>杂志介绍了一个很好用的单元测试工具"TestDriven.Net 2.0", 对于新手(我也是)需要补充说明的几点是:

    1,  要用"TestDriven.Net 2.0"进行单元测试除了安装"TestDriven.Net 2.0"外,你需要添加"nunit.framework"引用, 操作是"解决方案管理器-->引用-->(鼠标右键)添加引用-->.net-->nunit.framework.

    2,   添加名字空间
    using NUnit.Framework;

        为测试的类添加[TestFixture]特性
        为测试方法添加[Test]特性

    3, 示例代码
    using System;
    using System.Collections.Generic;
    using System.Text;
    using NUnit.Framework;

    namespace TestDrivenTest
    {
        [TestFixture]
        
    public class TestClass
        
    {
            [Test]
            
    public void TestRun()
            
    {
                Form1 frm1 
    = new Form1();
                
    int expected = 0;
                
    int result = frm1.GetResult(2);
                Assert.AreEqual(expected, result);
            }

        }

    }

  • 相关阅读:
    DIV 设置垂直居中
    JavaScript--什么是函数
    JavaScript--引用JS外部文件
    JavaScript--如何插入JS
    CSS-类和ID选择器的区别
    CSS-ID选择器
    CSS类选择器
    CSS样式介绍
    HTML--使用mailto在网页中链接Email地址
    HTML--form表单中的label标签
  • 原文地址:https://www.cnblogs.com/zhouyinhui/p/590535.html
Copyright © 2011-2022 走看看