Use Assert.Throws for reviewed NUnit2 ExpectedException tests
ProprietaryStandalone opt-in port of bound NUnit2 Test/ExpectedException(typeof(E)) with an optional single non-null string literal ExpectedMessage for genuine platform ArgumentException/ArgumentNullException on closed synchronous parameterless void block methods. Preserve the original body inside a TestDelegate; enforce a supplied exact message with the bound Assert.AreEqual(object, object) overload. Requires reviewed genuine NUnit 2.5+ metadata, no implicit fixture exception handler, no NUnit result-control or NUnitException wrapper exceptions, and one runtime type identity per expected full name. Does not migrate packages, projects or other attributes and is not composed into upgrades. Skips conditional files, source API shadows, unsupported lambda effects and comments on removed attributes.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. NetFramework. UseAssertThrowsForNUnit2ExpectedExceptionOptional
Confirm genuine NUnit 2.5+ metadata throughout the compilation (including other source files), absence of implicit IExpectException handlers and result-control or NUnitException wrapper exceptions in the test's call graph, and unique runtime identity of expected exception full names. SDK attribution does not carry assembly identity. Default false.
mod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. NetFramework. UseAssertThrowsForNUnit2ExpectedExceptionInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.