Export (0) Print
Expand All

StringAssert Class

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

Object
  Microsoft.VisualStudio.TestTools.UnitTesting.StringAssert

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

public static class StringAssert

  NameDescription
Public methodStatic memberContains(String, String)Verifies that the first string contains the second string. This method is case sensitive.
Public methodStatic memberContains(String, String, String)Verifies that the first string contains the second string. Displays a message if the assertion fails. This method is case sensitive.
Public methodStatic memberContains(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.
Public methodStatic memberDoesNotMatch(String, Regex)Verifies that the specified string does not match the regular expression.
Public methodStatic memberDoesNotMatch(String, Regex, String)Verifies that the specified string does not match the regular expression. Displays a message if the assertion fails.
Public methodStatic memberDoesNotMatch(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.
Public methodStatic memberEndsWith(String, String)Verifies that the first string ends with the second string. This method is case sensitive.
Public methodStatic memberEndsWith(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.
Public methodStatic memberEndsWith(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.
Public methodStatic memberMatches(String, Regex)Verifies that the specified string matches the regular expression.
Public methodStatic memberMatches(String, Regex, String)Verifies that the specified string matches the regular expression. Displays a message if the assertion fails.
Public methodStatic memberMatches(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.
Public methodStatic memberStartsWith(String, String)Verifies that the first string begins with the second string. This method is case sensitive.
Public methodStatic memberStartsWith(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.
Public methodStatic memberStartsWith(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.
Top

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.

Important noteImportant

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.
Show:
© 2014 Microsoft