码迷,mamicode.com
首页 > Windows程序 > 详细

C# Nunit Unit Testing

时间:2014-11-21 06:54:42      阅读:254      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   ar   color   sp   on   div   

http://www.youtube.com/watch?v=1TPZetHaZ-A          Introduction To NUnit

 

1. create Nunit test case

(1)new Project -> Class Library C#

(2) add new item -> Class C#

(3) add service :nunit.framework.dll

(4) add

using NUnit.Framework;

(5) code

namespace MyUnitTest
{
    [TestFixture]
    class Test7CalDay
    {
        [Test]
        public void test1()
        {
            CalculateDayService.CalculateDayServiceClient client = new CalculateDayService.CalculateDayServiceClient();
            string day1 = "20140801";
            string day2 = "20140802";
            int diff = client.CalculateDay(day1, day2);
            Assert.AreEqual(1, diff);
        }
    }
}

 2. testing tool

  (1) resharper

C# Nunit Unit Testing

标签:style   blog   http   io   ar   color   sp   on   div   

原文地址:http://www.cnblogs.com/phoenix13suns/p/4111913.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!