Your statement for Is.Null.Or.Empty reads fine without the Test class. Moreover, when this statement fails, you know exactly what happened: you have a valid string object that is not empty.
The problems that I see with the "negative version" of the version of its denial, i.e. Is.Not.Null.And.Not.Empty , that it is too long, and it does not read almost as well as Is.Null.Or.Empty .
However, instead of making a separate restriction for him, I would have to defend my parts separately, i.e.
Assert.That(result, Is.Not.Null); Assert.That(result, Is.Not.Empty);
The reason I do this is because the two failure conditions do not overlap, i.e. result may be null , or it may be empty, but it cannot be simultaneously at the same time. In one connection statement, no distinction is made between the two situations, so you end up sending a debugger to determine if the result null or empty.
Separate statements, on the other hand, tell you what happens while remaining very readable. They "stand" for one additional line per statement; I think it's a reasonable cost to get more accurate information about potential failures.
dasblinkenlight
source share