void TestStartTwiceFails() { SCXCoreLib::SCXHandle<SCXCoreLib::SCXThread> thread = GivenARunningThread(); SCXUNIT_ASSERT_THROWN_EXCEPTION(thread->Start(SCXThreadTest::SimpleThreadBodyTerminate), SCXCoreLib::SCXThreadStartException, L"started"); thread->RequestTerminate(); thread->Wait(); }
void TestThreadExceptionHaveCorrectThreadID() { SCXCoreLib::SCXHandle<SCXCoreLib::SCXThread> thread = GivenARunningThread(); try { thread->Start(SCXThreadTest::SimpleThreadBodyTerminate); CPPUNIT_FAIL("Expected exception not thrown: SCXThreadStartException"); } catch (SCXCoreLib::SCXThreadStartException& e) { CPPUNIT_ASSERT_EQUAL(SCXCoreLib::SCXThread::GetCurrentThreadID(), e.GetThreadID()); } }