如何为 TEST_METHOD 内联设置超时或“允许的持续时间”?
#include "stdafx.h"
#include "CppUnitTest.h"
#include "UT_TestSupport.h"
//---------------------------------------------------------------------------------------
// Namespace references
//---------------------------------------------------------------------------------------
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace std::chrono_literals;
//---------------------------------------------------------------------------------------
namespace SYEUnitTests
{
TEST_CLASS(TC_TcpSocket)
{
public:
// Method will run forever until it is killed
TEST_METHOD(TM_RunForever) // how to set a Timeout inline?
{
int sum = 0;
// - - - - - - - - - - - - - - - -
// BLACK BOX: can't touch this
// - - - - - - - - - - - - - - - -
while(true)
{
sum++;
}
// - - - - - - - - - - - - - - - -
}
}
}