I’m trying to set a category so I can exclude hardware tests on our build server:
namespace MyNamespace
{
using namespace NUnit::Framework;
[TestFixture]
[Category("RequiresHardware")]
public ref class UnitTest_SomeHardwareTests
{
...
};
}
…but I get an error when I try and use categories:
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'
How do I tell it to use NUnit?
The following two approaches work for me:
Either, explicitly indicate the fully qualified attribute name in the attribute specification, i.e.
Or, add a
usingdeclaration to indicate exactly whichCategoryAttributeyou intend to use: