验证 Nunit 中的异常

Validating the exception in Nunit

谁能帮我在 Nunit 中实现预期的异常?。 在我的 Nunit 测试方法中,它会调用一个抛出异常的方法,我需要使用 Expected Exception

来验证 Nunit 中的异常

提前致谢

已解决,谢谢。使用以下代码解决了这个问题 [ExpectedException(typeof(ErrorCodeException))]