Search Results for

    Show / Hide Table of Contents

    Class StringAssert

    Basic Asserts on strings.

    Inheritance
    object
    AssertBase
    StringAssert
    Inherited Members
    AssertBase.ConvertMessageWithArgs(string, object[])
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: NUnit.Framework.Legacy
    Assembly: nunit.framework.legacy.dll
    Syntax
    public abstract class StringAssert : AssertBase

    Constructors

    View Source

    StringAssert()

    Declaration
    protected StringAssert()

    Methods

    View Source

    AreEqualIgnoringCase(string, string)

    Asserts that two strings are equal, without regard to case.

    Declaration
    public static void AreEqualIgnoringCase(string expected, string actual)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The actual string

    View Source

    AreEqualIgnoringCase(string, string, string, params object?[]?)

    Asserts that two strings are equal, without regard to case.

    Declaration
    public static void AreEqualIgnoringCase(string expected, string actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The actual string

    string message

    The message to display in case of failure

    object[] args

    Arguments used in formatting the message

    View Source

    AreNotEqualIgnoringCase(string, string)

    Asserts that two strings are not equal, without regard to case.

    Declaration
    public static void AreNotEqualIgnoringCase(string expected, string actual)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The actual string

    View Source

    AreNotEqualIgnoringCase(string, string, string, params object?[]?)

    Asserts that two strings are not equal, without regard to case.

    Declaration
    public static void AreNotEqualIgnoringCase(string expected, string actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The actual string

    string message

    The message to display in case of failure

    object[] args

    Arguments used in formatting the message

    View Source

    Contains(string, string)

    Asserts that a string is found within another string.

    Declaration
    public static void Contains(string expected, string actual)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The string to be examined

    View Source

    Contains(string, string, string, params object?[]?)

    Asserts that a string is found within another string.

    Declaration
    public static void Contains(string expected, string actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The string to be examined

    string message

    The message to display in case of failure

    object[] args

    Arguments used in formatting the message

    View Source

    DoesNotContain(string, string)

    Asserts that a string is found within another string.

    Declaration
    public static void DoesNotContain(string expected, string actual)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The string to be examined

    View Source

    DoesNotContain(string, string, string, params object?[]?)

    Asserts that a string is not found within another string.

    Declaration
    public static void DoesNotContain(string expected, string actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The string to be examined

    string message

    The message to display in case of failure

    object[] args

    Arguments used in formatting the message

    View Source

    DoesNotEndWith(string, string)

    Asserts that a string does not end with another string.

    Declaration
    public static void DoesNotEndWith(string expected, string actual)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The string to be examined

    View Source

    DoesNotEndWith(string, string, string, params object?[]?)

    Asserts that a string does not end with another string.

    Declaration
    public static void DoesNotEndWith(string expected, string actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The string to be examined

    string message

    The message to display in case of failure

    object[] args

    Arguments used in formatting the message

    View Source

    DoesNotMatch(string, string)

    Asserts that a string does not match an expected regular expression pattern.

    Declaration
    public static void DoesNotMatch(string pattern, string actual)
    Parameters
    Type Name Description
    string pattern

    The regex pattern to be used

    string actual

    The actual string

    View Source

    DoesNotMatch(string, string, string, params object?[]?)

    Asserts that a string does not match an expected regular expression pattern.

    Declaration
    public static void DoesNotMatch(string pattern, string actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    string pattern

    The regex pattern to be used

    string actual

    The actual string

    string message

    The message to display in case of failure

    object[] args

    Arguments used in formatting the message

    View Source

    DoesNotStartWith(string, string)

    Asserts that a string does not start with another string.

    Declaration
    public static void DoesNotStartWith(string expected, string actual)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The string to be examined

    View Source

    DoesNotStartWith(string, string, string, params object?[]?)

    Asserts that a string does not start with another string.

    Declaration
    public static void DoesNotStartWith(string expected, string actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The string to be examined

    string message

    The message to display in case of failure

    object[] args

    Arguments used in formatting the message

    View Source

    EndsWith(string, string)

    Asserts that a string ends with another string.

    Declaration
    public static void EndsWith(string expected, string actual)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The string to be examined

    View Source

    EndsWith(string, string, string, params object?[]?)

    Asserts that a string ends with another string.

    Declaration
    public static void EndsWith(string expected, string actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The string to be examined

    string message

    The message to display in case of failure

    object[] args

    Arguments used in formatting the message

    View Source

    IsMatch(string, string)

    Asserts that a string matches an expected regular expression pattern.

    Declaration
    public static void IsMatch(string pattern, string actual)
    Parameters
    Type Name Description
    string pattern

    The regex pattern to be matched

    string actual

    The actual string

    View Source

    IsMatch(string, string, string, params object?[]?)

    Asserts that a string matches an expected regular expression pattern.

    Declaration
    public static void IsMatch(string pattern, string actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    string pattern

    The regex pattern to be matched

    string actual

    The actual string

    string message

    The message to display in case of failure

    object[] args

    Arguments used in formatting the message

    View Source

    StartsWith(string, string)

    Asserts that a string starts with another string.

    Declaration
    public static void StartsWith(string expected, string actual)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The string to be examined

    View Source

    StartsWith(string, string, string, params object?[]?)

    Asserts that a string starts with another string.

    Declaration
    public static void StartsWith(string expected, string actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    string expected

    The expected string

    string actual

    The string to be examined

    string message

    The message to display in case of failure

    object[] args

    Arguments used in formatting the message

    • 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