nUnit Assert.That(method,Throws.Exception) not catching exceptions

Try this instead:

Assert.That(() => Int32.Parse("abc"), Throws.Exception.TypeOf<FormatException>());

Basically you need to pass a delegate to Assert.That, just like the documentation in your link states (note that I’ve used a lambda expression here, but it should be the same).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)