Search Results for

    Show / Hide Table of Contents

    Class StringConstraint

    StringConstraint is the abstract base for constraints that operate on strings. It supports the IgnoreCase modifier for string operations.

    Inheritance
    object
    Constraint
    StringConstraint
    EmptyStringConstraint
    EndsWithConstraint
    PathConstraint
    StartsWithConstraint
    SubstringConstraint
    WhiteSpaceConstraint
    Implements
    IConstraint
    IResolveConstraint
    Inherited Members
    Constraint.ApplyTo<TActual>(ActualValueDelegate<TActual>)
    Constraint.ApplyTo<TActual>(ref TActual)
    Constraint.ApplyToAsync<TActual>(Func<Task<TActual>>)
    Constraint.GetTestObject<TActual>(ActualValueDelegate<TActual>)
    Constraint.ToString()
    Constraint.GetStringRepresentation(IEnumerable)
    Constraint.GetStringRepresentation()
    Constraint.After(int)
    Constraint.After(int, int)
    Constraint.DisplayName
    Constraint.Arguments
    Constraint.Builder
    Constraint.And
    Constraint.With
    Constraint.Or
    object.GetType()
    object.MemberwiseClone()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: NUnit.Framework.Constraints
    Assembly: nunit.framework.dll
    Syntax
    public abstract class StringConstraint : Constraint, IConstraint, IResolveConstraint

    Constructors

    View Source

    StringConstraint()

    Constructs a StringConstraint without an expected value

    Declaration
    protected StringConstraint()
    View Source

    StringConstraint(string)

    Constructs a StringConstraint given an expected value

    Declaration
    protected StringConstraint(string expected)
    Parameters
    Type Name Description
    string expected

    The expected value

    Fields

    View Source

    caseInsensitive

    Indicates whether tests should be case-insensitive

    Declaration
    protected bool caseInsensitive
    Field Value
    Type Description
    bool
    View Source

    descriptionText

    Description of this constraint

    Declaration
    protected string descriptionText
    Field Value
    Type Description
    string
    View Source

    expected

    The expected value

    Declaration
    protected readonly string expected
    Field Value
    Type Description
    string

    Properties

    View Source

    Description

    The Description of what this constraint tests, for use in messages and in the ConstraintResult.

    Declaration
    public override string Description { get; }
    Property Value
    Type Description
    string
    Overrides
    Constraint.Description
    View Source

    IgnoreCase

    Modify the constraint to ignore case in matching.

    Declaration
    public virtual StringConstraint IgnoreCase { get; }
    Property Value
    Type Description
    StringConstraint

    Methods

    View Source

    ApplyTo<TActual>(TActual)

    Test whether the constraint is satisfied by a given value

    Declaration
    public override ConstraintResult ApplyTo<TActual>(TActual actual)
    Parameters
    Type Name Description
    TActual actual

    The value to be tested

    Returns
    Type Description
    ConstraintResult

    True for success, false for failure

    Type Parameters
    Name Description
    TActual
    Overrides
    Constraint.ApplyTo<TActual>(TActual)
    View Source

    Matches(string?)

    Test whether the constraint is satisfied by a given string

    Declaration
    protected abstract bool Matches(string? actual)
    Parameters
    Type Name Description
    string actual

    The string to be tested

    Returns
    Type Description
    bool

    True for success, false for failure

    Implements

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