代码之家  ›  专栏  ›  技术社区  ›  Dan Appleyard

如何让Nunit与Visual Studio 2008一起工作

  •  0
  • Dan Appleyard  · 技术社区  · 14 年前

    也许我忘了什么,但我似乎不能让Nunit在Visual Studio 2008标准版中工作。我正试图在C类库项目中使用Nunit2.5.7。我遵循了Nunit下载中给出的样本结构。

    这是我要做的步骤
    1)下载安装nunit 2.5.7
    2)创建C类库项目
    3)在我的项目中添加nunit.framework的引用
    4)创建类
    5)添加“使用nunit.framework”
    6)从步骤3开始在我的类顶部添加[测试夹具]

    问题出现在步骤6,Visual Studio根本不识别TestFixtureAttribute或TestAttribute。 nunit下载附带的示例只包含步骤5中的using语句和[testfix]。我错过了什么?

    using System;
    using NUnit.Framework;
    
    namespace UnitTests
    {
        [TestFixture]
        public class MyUnitTests
        {
    
            [Test]
            public void TestMethod1()
            {
                //my unit test
            }    
    
        }
    }
    

    谢谢

    1 回复  |  直到 14 年前
        1
  •  2
  •   Beth Lang    14 年前

    你能在对象浏览器中查看nunit.framework吗?