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

你可能感兴趣的:(unit test)