-
Notifications
You must be signed in to change notification settings - Fork 153
NUnit2023
Mikkel Nylander Bundgaard edited this page Apr 25, 2020
·
2 revisions
Topic | Value |
---|---|
Id | NUnit2023 |
Severity | Warning |
Enabled | True |
Category | Assertion |
Code | NullConstraintUsageAnalyzer |
NullConstraint is allowed only for reference types or nullable value types.
Non-nullable value types cannot have null
value, therefore Is.Null
assertions will always fail (or will always pass for Is.Not.Null
).
Use suitable constraint.
Configure the severity per project, for more info see MSDN.
#pragma warning disable NUnit2023 // Invalid NullConstraint usage.
Code violating the rule here
#pragma warning restore NUnit2023 // Invalid NullConstraint usage.
Or put this at the top of the file to disable all instances.
#pragma warning disable NUnit2023 // Invalid NullConstraint usage.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Assertion",
"NUnit2023:Invalid NullConstraint usage.",
Justification = "Reason...")]
Copyright (c) 2018 The NUnit Project - Licensed under CC BY-NC-SA 4.0