C# Class NFluent.StringCheckExtensions

Provides check methods to be executed on a string instance.
Show file Open project: tpierrain/NFluent

Public Methods

Method Description
Contains ( this check ) : string[]>.IExtendableCheckLink

Checks that the string contains the given expected values, in any order.

DoesNotContain ( this check ) : ICheckLink>

Checks that the string does not contain any of the given expected values.

DoesNotMatch ( this check, string regExp ) : ICheckLink>

Checks that the string does not match a given regular expression.

EndsWith ( this check, string expectedEnd ) : ICheckLink>

Checks that the string ends with the given expected suffix.

HasContent ( this check ) : ICheckLink>

Checks that the string has content.

IsEmpty ( this check ) : ICheckLink>

Checks that the string is empty.

IsEqualIgnoringCase ( this check, string comparand ) : ICheckLink>

Checks that the string is equals to another one, disregarding case.

IsEqualTo ( this check, object expected ) : ICheckLink>

Checks that the checker value is equal to another expected value.

IsEqualTo ( this check, string expected ) : ICheckLink>

Checks that the checker value is equal to another expected value.

IsNotEmpty ( this check ) : ICheckLink>

Checks that the string is not empty.

IsNotEqualTo ( this check, object expected ) : ICheckLink>

Checks that the checker value is not equal to another expected value.

IsNotEqualTo ( this check, string expected ) : ICheckLink>

Checks that the checker value is not equal to another expected value.

IsNullOrEmpty ( this check ) : ICheckLink>

Checks that the string is empty or null.

IsOneOfThese ( this check ) : ICheckLink>

Checks that the checker value is one of these possible elements.

Matches ( this check, string regExp ) : ICheckLink>

Checks that the string matches a given regular expression.

StartsWith ( this check, string expectedPrefix ) : ICheckLink>

Checks that the string starts with the given expected prefix.

Private Methods

Method Description
AssessEquals ( IChecker checker, object expected, bool negated, bool ignoreCase = false ) : string
ContainsImpl ( IChecker checker, IEnumerable values, bool negated, bool notContains ) : string
EndsWithImpl ( IChecker checker, string ends, bool negated ) : string
HighlightFirstCrlfOrLfIfAny ( string str, int firstDiffPos ) : string

Inserts <<CRLF>> before the first CRLF or <<LF>> before the first LF.

HighlightTabsIfAny ( string str ) : string

Replace every tab char by "<<tab>>".

IsACRLFDifference ( int firstDiff, string expected, string actual ) : bool
IsATabAndWhiteSpaceDifference ( int firstDiff, string expected, string actual ) : bool
IsEmptyImpl ( IChecker checker, bool canBeNull, bool negated ) : string
MatchesImpl ( IChecker checker, string regExp, bool negated ) : string
StartsWithImpl ( IChecker checker, string starts, bool negated ) : string

Method Details

Contains() public static method

Checks that the string contains the given expected values, in any order.
The string contains all the given strings in any order.
public static Contains ( this check ) : string[]>.IExtendableCheckLink
check this The fluent check to be extended.
return string[]>.IExtendableCheckLink

DoesNotContain() public static method

Checks that the string does not contain any of the given expected values.
The string contains at least one of the given strings.
public static DoesNotContain ( this check ) : ICheckLink>
check this The fluent check to be extended.
return ICheckLink>

DoesNotMatch() public static method

Checks that the string does not match a given regular expression.
The string does not end with the expected prefix.
public static DoesNotMatch ( this check, string regExp ) : ICheckLink>
check this The fluent check to be extended.
regExp string The regular expression prefix.
return ICheckLink>

EndsWith() public static method

Checks that the string ends with the given expected suffix.
The string does not end with the expected prefix.
public static EndsWith ( this check, string expectedEnd ) : ICheckLink>
check this The fluent check to be extended.
expectedEnd string The expected suffix.
return ICheckLink>

HasContent() public static method

Checks that the string has content.
The string is empty or null.
public static HasContent ( this check ) : ICheckLink>
check this The fluent check to be extended.
return ICheckLink>

IsEmpty() public static method

Checks that the string is empty.
The string is not empty.
public static IsEmpty ( this check ) : ICheckLink>
check this The fluent check.
return ICheckLink>

IsEqualIgnoringCase() public static method

Checks that the string is equals to another one, disregarding case.
The string is not equal to the comparand.
public static IsEqualIgnoringCase ( this check, string comparand ) : ICheckLink>
check this The fluent check to be extended.
comparand string The string to compare to.
return ICheckLink>

IsEqualTo() public static method

Checks that the checker value is equal to another expected value.
The checker value is not equal to the expected value.
public static IsEqualTo ( this check, object expected ) : ICheckLink>
check this The fluent check to be extended.
expected object The expected value.
return ICheckLink>

IsEqualTo() public static method

Checks that the checker value is equal to another expected value.
The checker value is not equal to the expected value.
public static IsEqualTo ( this check, string expected ) : ICheckLink>
check this The fluent check to be extended.
expected string The expected value.
return ICheckLink>

IsNotEmpty() public static method

Checks that the string is not empty.
The string is empty.
public static IsNotEmpty ( this check ) : ICheckLink>
check this The fluent check to be extended.
return ICheckLink>

IsNotEqualTo() public static method

Checks that the checker value is not equal to another expected value.
The checker value is equal to the expected value.
public static IsNotEqualTo ( this check, object expected ) : ICheckLink>
check this The fluent check to be extended.
expected object The expected value.
return ICheckLink>

IsNotEqualTo() public static method

Checks that the checker value is not equal to another expected value.
The checker value is equal to the expected value.
public static IsNotEqualTo ( this check, string expected ) : ICheckLink>
check this The fluent check to be extended.
expected string The expected value.
return ICheckLink>

IsNullOrEmpty() public static method

Checks that the string is empty or null.
The string is neither empty or null.
public static IsNullOrEmpty ( this check ) : ICheckLink>
check this The fluent check.
return ICheckLink>

IsOneOfThese() public static method

Checks that the checker value is one of these possible elements.
The checker value is NOT one of the elements.
public static IsOneOfThese ( this check ) : ICheckLink>
check this The check.
return ICheckLink>

Matches() public static method

Checks that the string matches a given regular expression.
The string does not end with the expected prefix.
public static Matches ( this check, string regExp ) : ICheckLink>
check this The fluent check to be extended.
regExp string The regular expression.
return ICheckLink>

StartsWith() public static method

Checks that the string starts with the given expected prefix.
The string does not start with the expected prefix.
public static StartsWith ( this check, string expectedPrefix ) : ICheckLink>
check this The fluent check to be extended.
expectedPrefix string The expected prefix.
return ICheckLink>