1

ビルド サーバーでハードウェア テストを除外できるように、カテゴリを設定しようとしています。

namespace MyNamespace
{
    using namespace NUnit::Framework;

    [TestFixture]
    [Category("RequiresHardware")]
    public ref class UnitTest_SomeHardwareTests
    {
        ...
    };
}

...しかし、カテゴリを使用しようとするとエラーが発生します。

1>c:\projects\testing\UnitTest_MainSystem.h(14) : error C2872: 'CategoryAttribute' : ambiguous symbol
1>        could be 'c:\program files (x86)\nunit 2.5.9\bin\net-2.0\framework\nunit.framework.dll : NUnit::Framework::CategoryAttribute'
1>        or       'c:\windows\microsoft.net\framework\v2.0.50727\system.dll : System::ComponentModel::CategoryAttribute'

NUnit を使用するように指示するにはどうすればよいですか?

4

1 に答える 1

2

次の2つのアプローチが私にとってはうまくいきます:

または、属性指定で完全修飾属性名を明示的に示します。つまり、

[NUnit::Framework::Category("RequiresHardware")]

usingまたは、どちらを使用するかを正確に示す宣言を追加CategoryAttributeします。

using NUnit::Framework::CategoryAttribute;
于 2012-09-20T10:57:14.200 に答える