Search Results for

    Show / Hide Table of Contents

    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 a DirectoryInfo.
    • 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