Class StringAssert
Basic Asserts on strings.
public class StringAssert
- Inheritance
-
StringAssert
- Inherited Members
Constructors
StringAssert()
public StringAssert()
Methods
AreEqualIgnoringCase(string, string)
Asserts that two strings are equal, without regard to case.
public static void AreEqualIgnoringCase(string expected, string actual)
Parameters
AreEqualIgnoringCase(string, string, string)
Asserts that two strings are equal, without regard to case.
public static void AreEqualIgnoringCase(string expected, string actual, string message)
Parameters
expected
stringThe expected string
actual
stringThe actual string
message
stringThe message to display in case of failure
AreEqualIgnoringCase(string, string, string, params object[])
Asserts that two strings are equal, without regard to case.
public static void AreEqualIgnoringCase(string expected, string actual, string message, params object[] args)
Parameters
expected
stringThe expected string
actual
stringThe actual string
message
stringThe message to display in case of failure
args
object[]Arguments used in formatting the message
AreNotEqualIgnoringCase(string, string)
Asserts that two strings are not equal, without regard to case.
public static void AreNotEqualIgnoringCase(string expected, string actual)
Parameters
AreNotEqualIgnoringCase(string, string, string)
Asserts that two strings are Notequal, without regard to case.
public static void AreNotEqualIgnoringCase(string expected, string actual, string message)
Parameters
expected
stringThe expected string
actual
stringThe actual string
message
stringThe message to display in case of failure
AreNotEqualIgnoringCase(string, string, string, params object[])
Asserts that two strings are not equal, without regard to case.
public static void AreNotEqualIgnoringCase(string expected, string actual, string message, params object[] args)
Parameters
expected
stringThe expected string
actual
stringThe actual string
message
stringThe message to display in case of failure
args
object[]Arguments used in formatting the message
Contains(string, string)
Asserts that a string is found within another string.
public static void Contains(string expected, string actual)
Parameters
Contains(string, string, string)
Asserts that a string is found within another string.
public static void Contains(string expected, string actual, string message)
Parameters
expected
stringThe expected string
actual
stringThe string to be examined
message
stringThe message to display in case of failure
Contains(string, string, string, params object[])
Asserts that a string is found within another string.
public static void Contains(string expected, string actual, string message, params object[] args)
Parameters
expected
stringThe expected string
actual
stringThe string to be examined
message
stringThe message to display in case of failure
args
object[]Arguments used in formatting the message
DoesNotContain(string, string)
Asserts that a string is found within another string.
public static void DoesNotContain(string expected, string actual)
Parameters
DoesNotContain(string, string, string)
Asserts that a string is found within another string.
public static void DoesNotContain(string expected, string actual, string message)
Parameters
expected
stringThe expected string
actual
stringThe string to be examined
message
stringThe message to display in case of failure
DoesNotContain(string, string, string, params object[])
Asserts that a string is not found within another string.
public static void DoesNotContain(string expected, string actual, string message, params object[] args)
Parameters
expected
stringThe expected string
actual
stringThe string to be examined
message
stringThe message to display in case of failure
args
object[]Arguments used in formatting the message
DoesNotEndWith(string, string)
Asserts that a string does not end with another string.
public static void DoesNotEndWith(string expected, string actual)
Parameters
DoesNotEndWith(string, string, string)
Asserts that a string does not end with another string.
public static void DoesNotEndWith(string expected, string actual, string message)
Parameters
expected
stringThe expected string
actual
stringThe string to be examined
message
stringThe message to display in case of failure
DoesNotEndWith(string, string, string, params object[])
Asserts that a string does not end with another string.
public static void DoesNotEndWith(string expected, string actual, string message, params object[] args)
Parameters
expected
stringThe expected string
actual
stringThe string to be examined
message
stringThe message to display in case of failure
args
object[]Arguments used in formatting the message
DoesNotMatch(string, string)
Asserts that a string does not match an expected regular expression pattern.
public static void DoesNotMatch(string pattern, string actual)
Parameters
DoesNotMatch(string, string, string)
Asserts that a string does not match an expected regular expression pattern.
public static void DoesNotMatch(string pattern, string actual, string message)
Parameters
pattern
stringThe regex pattern to be used
actual
stringThe actual string
message
stringThe message to display in case of failure
DoesNotMatch(string, string, string, params object[])
Asserts that a string does not match an expected regular expression pattern.
public static void DoesNotMatch(string pattern, string actual, string message, params object[] args)
Parameters
pattern
stringThe regex pattern to be used
actual
stringThe actual string
message
stringThe message to display in case of failure
args
object[]Arguments used in formatting the message
DoesNotStartWith(string, string)
Asserts that a string does not start with another string.
public static void DoesNotStartWith(string expected, string actual)
Parameters
DoesNotStartWith(string, string, string)
Asserts that a string does not start with another string.
public static void DoesNotStartWith(string expected, string actual, string message)
Parameters
expected
stringThe expected string
actual
stringThe string to be examined
message
stringThe message to display in case of failure
DoesNotStartWith(string, string, string, params object[])
Asserts that a string does not start with another string.
public static void DoesNotStartWith(string expected, string actual, string message, params object[] args)
Parameters
expected
stringThe expected string
actual
stringThe string to be examined
message
stringThe message to display in case of failure
args
object[]Arguments used in formatting the message
EndsWith(string, string)
Asserts that a string ends with another string.
public static void EndsWith(string expected, string actual)
Parameters
EndsWith(string, string, string)
Asserts that a string ends with another string.
public static void EndsWith(string expected, string actual, string message)
Parameters
expected
stringThe expected string
actual
stringThe string to be examined
message
stringThe message to display in case of failure
EndsWith(string, string, string, params object[])
Asserts that a string ends with another string.
public static void EndsWith(string expected, string actual, string message, params object[] args)
Parameters
expected
stringThe expected string
actual
stringThe string to be examined
message
stringThe message to display in case of failure
args
object[]Arguments used in formatting the message
IsMatch(string, string)
Asserts that a string matches an expected regular expression pattern.
public static void IsMatch(string pattern, string actual)
Parameters
IsMatch(string, string, string)
Asserts that a string matches an expected regular expression pattern.
public static void IsMatch(string pattern, string actual, string message)
Parameters
pattern
stringThe regex pattern to be matched
actual
stringThe actual string
message
stringThe message to display in case of failure
IsMatch(string, string, string, params object[])
Asserts that a string matches an expected regular expression pattern.
public static void IsMatch(string pattern, string actual, string message, params object[] args)
Parameters
pattern
stringThe regex pattern to be matched
actual
stringThe actual string
message
stringThe message to display in case of failure
args
object[]Arguments used in formatting the message
ReferenceEquals(object, object)
override the default ReferenceEquals to throw an AssertionException. This implementation makes sure there is no mistake in calling this function as part of Assert.
public static void ReferenceEquals(object a, object b)
Parameters
StartsWith(string, string)
Asserts that a string starts with another string.
public static void StartsWith(string expected, string actual)
Parameters
StartsWith(string, string, string)
Asserts that a string starts with another string.
public static void StartsWith(string expected, string actual, string message)
Parameters
expected
stringThe expected string
actual
stringThe string to be examined
message
stringThe message to display in case of failure
StartsWith(string, string, string, params object[])
Asserts that a string starts with another string.
public static void StartsWith(string expected, string actual, string message, params object[] args)