1. Set up a ManualResetEvent
2. Create and start a new Thread Using threads and threading | Microsoft Docs
a. Calls the method under test
b. Sets the ManualResetEvent you created in step 1
3. (In the original thread): Call ManualResetEventSlim.Wait Method (System.Threading) | Microsoft Docs
] with a reasonable timeout (a second should be enough as long as you do not call with int.MinValue).
4. If Wait returned false, call Thread.Abort Method (System.Threading) | Microsoft Docs
] and fail the test.
If it had to be really robust, I would consider spinning the test off to a different appdomain or process. Having a thread run out of stack space in your main process sounds somewhat risky to me, after all it does share address space with everything else. And remember while this test is specifically designed to initial run out of stack space, any answer to any test could do this by accident. And they could also call commands to format the drive "by accident", but I assume you are not running random peoples code on your own server. :)