Search Results for

    Show / Hide Table of Contents

    StartsWith Constraint

    StartsWithConstraint tests for an initial string.

    Constructor

    StartsWithConstraint(string expected)
    

    Syntax

    Does.StartWith(string expected)
    StartsWith(string expected)
    

    Modifiers

    ...IgnoreCase
    

    Examples of Use

    string phrase = "Make your tests fail before passing!";
    
    Assert.That(phrase, Does.StartWith("Make"));
    Assert.That(phrase, Does.Not.StartWith("Break"));
    

    Notes

    1. StartsWith may appear only in the body of a constraint expression or when the inherited syntax is used.
    • 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