Using Nunit 3
Test Case: that a thread I created and started, throws an ThreadAbortException when I abort the the thread
Expected Result: to pass (for test to confirm that ThreadAbortException happened)
Result: is failed with error
NUnit.Framework.AssertionException: ' Expected: <System.Threading.ThreadAbortException>
But was: null
Nunit 3 test code:
[SetUp]
public void Setup()
{
_threadViewModel.CreateThread();
}
[Test]
public void TestThreadThrowsAbortedException()
{
try
{
_threadViewModel.RunThread();
Assert.Throws<ThreadAbortException>(() => _threadViewModel.AbortThread());
}
catch (ThreadAbortException e)
{
}
}
Visual Studio Output Window: the output window is correct
System.Threading.ThreadAbortException: Thread was being aborted. at Multthreading.ThreadRunner.WriteY()
Problem: the nunit 3 test does not confirm for me that the exception was thrown