155144

2008年5月12日14时28分

导航

21-ReSharper UnitRun for .net

ReSharper UnitRun is a free add-in for Microsoft Visual Studio 2005 that allows you to automatically run and profile unit tests.

1)Download ReSharper UnitRun from the link below :

          http://www.jetbrains.com/unitrun/download/index.html         

2)Get a free license,

          http://www.jetbrains.com/unitrun/download/registration.html

3)Install the software

       After installed the software, restart your vs2005.A Register window form will appear in the dotnet.Skip it.The another window form ask you enther the user name and key,input your license.Then press submit.

4)Get NUnit or csUnit

ReSharper UnitRun must be used together with NUint or csUnit.

you can get them from the link below:

http://sourceforge.net/

5)Install NUnit

6)Create a project for Test

       A:Create a project with name of "NUnitTest";

       B:Add reference NUnit.framework (NUnit setup path\bin\nunit.framework.dll)

       C:Create a "NumberFixture",

using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;

namespace NUnitTest
{
    [TestFixture]
        public class NumbersFixture
        {
        [Test]
            public void AddTwoNumbers()
            {
                Int32 a = 1;
                Int32 b = 2;
                Int32 sum = a + b;
                Assert.AreEqual(sum, 2);

            }
        }
}

7)Change property of the project NUnitTest

       A.Click "VS2005-Project-Property";

       B.Change:Start Action--Start external program: NUnit setup path + "\bin\nunit-gui.exe"

8)Debug this project.

 

9)Start NUnit

       A.Open Project: "File-Open project", select "NUnitTest.dll" from Server.Mappath("bin") ;

       B.Click "Run".

If the processbar is green,ok.Red bar means that there are somemistaks.yellow means?sorry, i don't remember.

10)Restart VS2005,you will see a green tag on the left of code area.

11)Click the Tag image

 

 

posted on 2008-05-18 13:52  155144  阅读(495)  评论(0编辑  收藏  举报