Getting Exception using Code on Thread.
Hello,
there is already a cool thread about this question I wanted to use, but i can't post a comment because I do not have a reputation of 50. So I needed to create a new Thread (which seems ridiculous for me...). I didn't want to post my question as an answer because that seems wrong to me. The thread I wanted to post on: How do I use Assert.Throws to assert the type of the exception?
My Problem: I'm using exactly the code demonstrated as answer, but I'm getting an Error: "NullReferenceException is a type and not valid in this context"
Here My Code:
if (toSort == null)
{
Assert.Throws<NullReferenceException>(() => { HeapSort.Sort(toSort); });
}
I'm very thankful for your time and help.
Best regards!