namespace NUnit.Framework { /// /// Basic Asserts on strings. /// public class StringAssert { #region Contains /// /// Asserts that a string is found within another string. /// /// The expected string /// The string to be examined /// The message to display in case of failure /// Arguments used in formatting the message static public void Contains( string expected, string actual, string message, params object[] args ) { Assert.DoAssert( new ContainsAsserter( expected, actual, message, args ) ); } /// /// Asserts that a string is found within another string. /// /// The expected string /// The string to be examined /// The message to display in case of failure static public void Contains( string expected, string actual, string message ) { Contains( expected, actual, message, null ); } /// /// Asserts that a string is found within another string. /// /// The expected string /// The string to be examined static public void Contains( string expected, string actual ) { Contains( expected, actual, string.Empty, null ); } #endregion #region StartsWith /// /// Asserts that a string starts with another string. /// /// The expected string /// The string to be examined /// The message to display in case of failure /// Arguments used in formatting the message static public void StartsWith( string expected, string actual, string message, params object[] args ) { Assert.DoAssert( new StartsWithAsserter( expected, actual, message, args ) ); } /// /// Asserts that a string starts with another string. /// /// The expected string /// The string to be examined /// The message to display in case of failure static public void StartsWith( string expected, string actual, string message ) { StartsWith( expected, actual, message, null ); } /// /// Asserts that a string starts with another string. /// /// The expected string /// The string to be examined static public void StartsWith( string expected, string actual ) { StartsWith( expected, actual, string.Empty, null ); } #endregion #region EndsWith /// /// Asserts that a string ends with another string. /// /// The expected string /// The string to be examined /// The message to display in case of failure /// Arguments used in formatting the message static public void EndsWith( string expected, string actual, string message, params object[] args ) { Assert.DoAssert( new EndsWithAsserter( expected, actual, message, args ) ); } /// /// Asserts that a string ends with another string. /// /// The expected string /// The string to be examined /// The message to display in case of failure static public void EndsWith( string expected, string actual, string message ) { EndsWith( expected, actual, message, null ); } /// /// Asserts that a string ends with another string. /// /// The expected string /// The string to be examined static public void EndsWith( string expected, string actual ) { EndsWith( expected, actual, string.Empty, null ); } #endregion #region AreEqualIgnoringCase /// /// Asserts that two strings are equal, without regard to case. /// /// The expected string /// The actual string /// The message to display in case of failure /// Arguments used in formatting the message static public void AreEqualIgnoringCase( string expected, string actual, string message, params object[] args ) { Assert.DoAssert( new EqualIgnoringCaseAsserter( expected, actual, message, args ) ); } /// /// Asserts that two strings are equal, without regard to case. /// /// The expected string /// The actual string /// The message to display in case of failure static public void AreEqualIgnoringCase( string expected, string actual, string message ) { AreEqualIgnoringCase( expected, actual, message, null ); } /// /// Asserts that two strings are equal, without regard to case. /// /// The expected string /// The actual string static public void AreEqualIgnoringCase( string expected, string actual ) { AreEqualIgnoringCase( expected, actual, string.Empty, null ); } #endregion } }