Class StringAssert
Basic Asserts on strings.
Inherited Members
Namespace: NUnit.Framework.Legacy
Assembly: nunit.framework.legacy.dll
Syntax
public abstract class StringAssert : AssertBase
Constructors
View SourceStringAssert()
Declaration
protected StringAssert()
Methods
View SourceAreEqualIgnoringCase(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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |