Skip to content

EmptyCollectionConstraint

Chris Maddock edited this page Feb 14, 2016 · 5 revisions

The EmptyCollectionConstraint tests if a Collection is empty. An ArgumentException is thrown if the collection is null.

Constructor

```C# EmptyCollectionConstraint() ```

Syntax

```C# Is.Empty ```

Examples of Use

```C# Assert.That(new int[] { }, Is.Empty); Assert.That(new int[] { 1, 2, 3 }, Is.Not.Empty); ```

Note: Is.Empty actually creates an EmptyConstraint. Subsequently applying it to an IEnumerable or ICollection causes an EmptyCollectionConstraint to be created.

Clone this wiki locally