Exception 如何在C++/什么是IT测试?
你是如何做到这一点的:Exception 如何在C++/什么是IT测试?,exception,testing,nunit,c++-cli,expected-exception,Exception,Testing,Nunit,C++ Cli,Expected Exception,你是如何做到这一点的: [Test, ExpectedException( typeof(ArgumentOutOfRangeException) )] void Test_Something_That_Throws_Exception() { throw gcnew ArgumentOutOfRangeException("Some more detail"); } C++中的P>…(C的例子)据我所见,对于nUng. < P>的C++实现没有任何类型()函数,为了避免任何人在寻找它
[Test, ExpectedException( typeof(ArgumentOutOfRangeException) )]
void Test_Something_That_Throws_Exception()
{
throw gcnew ArgumentOutOfRangeException("Some more detail");
}
C++中的P>…(C的例子)据我所见,对于nUng.</P> < P>的C++实现没有任何类型()函数,为了避免任何人在寻找它的过程中四处寻找,这里给出了解决方案:
[Test, ExpectedException( ArgumentOutOfRangeException::typeid )]
void Test_Something_That_Throws_Exception()
{
throw gcnew ArgumentOutOfRangeException("Some more detail");
}
只需使用异常:-)的::typeid