/// <summary> /// Asserts that a string is exactly the same as another string, including the casing and any leading or trailing whitespace. /// </summary> /// <param name="expected">The expected string.</param> /// <param name="because"> /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically. /// </param> /// <param name="becauseArgs"> /// Zero or more objects to format using the placeholders in <see cref="because" />. /// </param> public AndConstraint <StringAssertions> Be(string expected, string because = "", params object[] becauseArgs) { var stringEqualityValidator = new StringEqualityValidator(Subject, expected, StringComparison.CurrentCulture, because, becauseArgs); stringEqualityValidator.Validate(); return(new AndConstraint <StringAssertions>(this)); }
/// <summary> /// Asserts that a string is exactly the same as another string, including any leading or trailing whitespace, with /// the exception of the casing. /// </summary> /// <param name="expected"> /// The string that the subject is expected to be equivalent to. /// </param> /// <param name="because"> /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically. /// </param> /// <param name="becauseArgs"> /// Zero or more objects to format using the placeholders in <see cref="because" />. /// </param> public AndConstraint <StringAssertions> BeEquivalentTo(string expected, string because = "", params object[] becauseArgs) { var expectation = new StringEqualityValidator( Subject, expected, StringComparison.CurrentCultureIgnoreCase, because, becauseArgs); expectation.Validate(); return(new AndConstraint <StringAssertions>(this)); }
/// <summary> /// Asserts that a string is exactly the same as another string, including any leading or trailing whitespace, with /// the exception of the casing. /// </summary> /// <param name="expected"> /// The string that the subject is expected to be equivalent to. /// </param> /// <param name="reason"> /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically. /// </param> /// <param name="reasonArgs"> /// Zero or more objects to format using the placeholders in <see cref="reason" />. /// </param> public AndConstraint<StringAssertions> BeEquivalentTo(string expected, string reason = "", params object[] reasonArgs) { var expectation = new StringEqualityValidator( Subject, expected, StringComparison.CurrentCultureIgnoreCase, reason, reasonArgs); expectation.Validate(); return new AndConstraint<StringAssertions>(this); }