Search Results for

    Show / Hide Table of Contents

    EmptyCollection Constraint

    The EmptyCollectionConstraint tests if a Collection or other IEnumerable is empty. An ArgumentException is thrown if the actual value is not an IEnumerable or is null.

    Constructor

    EmptyCollectionConstraint()
    

    Syntax

    Is.Empty
    

    Examples of Use

    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.

    • Edit this page
    In this article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0