You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operators are a bit confusing in NUnit. Personally I don't fully understand how they work.
I've seen multiple times that constraint Is.Not.Null.Or.Empty is used to validate that string is not empty, which is wrong - it should be either Is.Not.Null.And.Not.Empty, or Is.Not.Null & Is.Not.Empty, or !Is.Null.Or.Empty.
But it might be missed because Not operator precedence is not obvious (one of the reasons I prefer using &/| operators instead of .And/.Or).
Since Is.Not.Null.Or.Empty constraint makes no sense (empty string or collection is always not null), I suggest always marking it as warning.
Activity
manfred-brands commentedon Oct 31, 2025
After searching my work's code base and finding 60+ usages, I thought it is time for that rule.