NUnit 3.0 and Assert.Throws

前端 未结 3 1496
盖世英雄少女心
盖世英雄少女心 2020-12-05 03:55

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

3条回答
  •  生来不讨喜
    2020-12-05 04:28

    You can create a custom Attribute in NUnit 3. Here is the sample code how to create [ExpectedException] Attribute.(ExpectedExceptionExample Shows how to implement a custom attribute for NUnit) https://github.com/nunit/nunit-csharp-samples

提交回复
热议问题