所以我希望能够在其中指定不同的Exception消息,TestCase但不知道如何完成
这是原作
[Test]
[ExpectedException(typeof(SystemException), ExpectedMessage = "Holiday cannot start or end on a weekend or non-working day")]
public void AddHolidays_StartsInvlaid()
{}
Run Code Online (Sandbox Code Playgroud)
这是TestCase
[TestCase("27/04/2025", "28/05/2025", "FullDay", "FullDay", ExpectedMessage = "Holiday cannot start or end on a weekend or non-working day")]
[ExpectedException(typeof(SystemException), ExpectedMessage)]
public void AddHolidays_Exceptions(string dateFrom, string dateTo, string fromPeriod, string toPeriod)
{}
Run Code Online (Sandbox Code Playgroud)
该方法工作正常但我只是希望能够使用NUnit指定异常消息 TestCase