C# Nunit Unit Testing

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

上一篇:升级WIN10 (9879)后IE无响应的解决办法


下一篇:Qt5的插件机制(7)--插件开发示例代码(Lower-level API)