如何重写Nunit2的代码

本文关键字:Nunit2 代码 重写 何重写 | 更新日期: 2023-09-27 18:16:28

在第2单元中,我使用了以下代码:

 yield return new TestCaseData(sourceWordsModelEmpty, combinationsModelEmpty).SetName("FindCombinationsTest - Empty").Throws(typeof(Exception));

如何在Nuni3中使用它?

如何重写Nunit2的代码

我想你是有问题的Throws。删除它并将异常类型作为附加参数传入。然后在测试中,将抛出异常的代码包装在Assert.Throws中。