I am writing some unit tests with NUnit 3.0 and, unlike v2.x, ExpectedException() has been removed from the library.
Based on this answer, I can definit
In C# 7, there is another option (albeit very similar to the existing answers):
[Test]
public void Should_not_convert_from_prinergy_date_time_sample2()
{
void CheckFunction()
{
//Arrange
string testDate = "20121123120122";
//Act
testDate.FromPrinergyDateTime();
}
//Assert
Assert.Throws(typeof(Exception), CheckFunction);
}
Blog post on the subject