Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

StringAssert Class

 

Verifies true/false propositions associated with strings in unit tests.

Namespace:   Microsoft.VisualStudio.TestTools.UnitTesting
Assembly:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)

System.Object
  Microsoft.VisualStudio.TestTools.UnitTesting.StringAssert

No code example is currently available or this language may not be supported.

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticContains(String, String)

Verifies that the first string contains the second string. This method is case sensitive.

System_CAPS_pubmethodSystem_CAPS_staticContains(String, String, String)

Verifies that the first string contains the second string. Displays a message if the assertion fails. This method is case sensitive.

System_CAPS_pubmethodSystem_CAPS_staticContains(String, String, String, Object[])

Verifies that the first string contains the second string. Displays a message if the assertion fails, and applies the specified formatting to it. This method is case sensitive.

System_CAPS_pubmethodSystem_CAPS_staticDoesNotMatch(String, Regex)

Verifies that the specified string does not match the regular expression.

System_CAPS_pubmethodSystem_CAPS_staticDoesNotMatch(String, Regex, String)

Verifies that the specified string does not match the regular expression. Displays a message if the assertion fails.

System_CAPS_pubmethodSystem_CAPS_staticDoesNotMatch(String, Regex, String, Object[])

Verifies that the specified string does not match the regular expression. Displays a message if the assertion fails, and applies the specified formatting to it.

System_CAPS_pubmethodSystem_CAPS_staticEndsWith(String, String)

Verifies that the first string ends with the second string. This method is case sensitive.

System_CAPS_pubmethodSystem_CAPS_staticEndsWith(String, String, String)

Verifies that the first string ends with the second string. Displays a message if the assertion fails. This method is case sensitive.

System_CAPS_pubmethodSystem_CAPS_staticEndsWith(String, String, String, Object[])

Verifies that the first string ends with the second string. Displays a message if the assertion fails, and applies the specified formatting to it. This method is case sensitive.

System_CAPS_pubmethodSystem_CAPS_staticMatches(String, Regex)

Verifies that the specified string matches the regular expression.

System_CAPS_pubmethodSystem_CAPS_staticMatches(String, Regex, String)

Verifies that the specified string matches the regular expression. Displays a message if the assertion fails.

System_CAPS_pubmethodSystem_CAPS_staticMatches(String, Regex, String, Object[])

Verifies that the specified string matches the regular expression. Displays a message if the assertion fails, and applies the specified formatting to it.

System_CAPS_pubmethodSystem_CAPS_staticStartsWith(String, String)

Verifies that the first string begins with the second string. This method is case sensitive.

System_CAPS_pubmethodSystem_CAPS_staticStartsWith(String, String, String)

Verifies that the first string begins with the second string. Displays a message if the assertion fails. This method is case sensitive.

System_CAPS_pubmethodSystem_CAPS_staticStartsWith(String, String, String, Object[])

Verifies that the first string begins with the second string. Displays a message if the assertion fails, and applies the specified formatting to it. This method is case sensitive.

This class contains a set of static methods that evaluate a Boolean condition. If this condition evaluates to true, the assertion passes.

An assertion verifies an assumption of truth for compared conditions.

If the condition being verified is not true, the assertion fails.

System_CAPS_importantImportant

The StringAssert class throws an AssertFailedException to signal a failure. This exception should not be captured. This exception is handled by the unit test engine to indicate an assert failure.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: