Search Results for

    Show / Hide Table of Contents

    Substring Constraint

    SubstringConstraint tests for a substring.

    Constructor

    SubstringConstraint(string expected)
    

    Syntax

    Does.Contain(string expected)
    

    Modifiers

    ...IgnoreCase
    

    Examples of Use

    [Test]
    public void StringConstraint_Examples()
    {
        Assert.That("Hello World!", Does.StartWith("Hello"));
        Assert.That("Hello World!", Does.EndWith("World!"));
        Assert.That("Hello World!", Does.Contain("lo Wor"));
        Assert.That("Hello World!", Does.Match("H.*!"));
    }
    
    • 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