Empty Constraint
EmptyConstraint
tests that an object is an empty string, directory or collection.
Constructor
EmptyConstraint()
Syntax
Is.Empty
Examples of Use
[Test]
public void EmptyConstraint_Examples()
{
Assert.That("", Is.Empty);
Assert.That(new int[] {}, Is.Empty);
Assert.That(new List<string>(), Is.Empty);
Assert.That("Hello", Is.Not.Empty);
}
Notes
- EmptyConstraint creates and uses either an EmptyStringConstraint, EmptyDirectoryConstraint or EmptyCollectionConstraint depending on the argument tested.
- A
DirectoryInfo
argument is required in order to test for an empty directory. To test whether a string represents a directory path, you must first construct aDirectoryInfo
.