Joutsen v0.5.0+12-g5dd5f7e
Public Member Functions | Properties | List of all members
Joutsen.NUnit3.EqualStringsConstraint Class Reference

A nunit constraint to compare strings which offers formatting and ignoring of line breaks. More...

Public Member Functions

 EqualStringsConstraint (String expected, params object[] parameters)
 Creates a new instance of the constraint. More...
 
 EqualStringsConstraint (String expected, Map< string, object > parameters)
 Creates a new instance of the constraint. More...
 
 EqualStringsConstraint (String expected, object parameter)
 Creates a new instance of the constraint. More...
 
override ConstraintResult ApplyTo< TActual > (TActual actual)
 Applies the constraint to the actual value. More...
 

Properties

bool CaseInsensitive [get]
 Determines wether the evaluation should ignore the case of the strings characters. More...
 
bool ClipStrings [get]
 Determines wether whitespaces should be removed from the start and end of the actual string before the evaluation of the constraint. More...
 
bool WithLineBreaks [get]
 Determines whether line breaks should be removed from the actual string before the evaluation of the constraint. More...
 
EqualStringsConstraint IgnoreCase [get]
 Creates a constraint that will ignore the case of the compared strings. More...
 
EqualStringsConstraint NoClip [get]
 Creates a constraint that will not remove the whitespaces from the beginning and end of the strings. More...
 
EqualStringsConstraint IgnoreLineBreaks [get]
 Creates a constraint that will ignore the line breaks of the compared strings. More...
 
override string Description [get]
 Provide a description of the constraint for messages. More...
 

Detailed Description

A nunit constraint to compare strings which offers formatting and ignoring of line breaks.

Since
0.2.1

Constructor & Destructor Documentation

◆ EqualStringsConstraint() [1/3]

Joutsen.NUnit3.EqualStringsConstraint.EqualStringsConstraint ( String  expected,
params object[]  parameters 
)

Creates a new instance of the constraint.

Parameters
expectedthe expected string value that will be used when the constraint is evaluated
parametersan array of parameters which are used to format the expected and the actual string before the constraint is evaluated
Remarks
the strings can use the same placeholders which are used for the String.Format method.

◆ EqualStringsConstraint() [2/3]

Joutsen.NUnit3.EqualStringsConstraint.EqualStringsConstraint ( String  expected,
Map< string, object >  parameters 
)

Creates a new instance of the constraint.

Parameters
expectedthe expected string value that will be used when the constraint is evaluated
parametersname value pairs which are used to format the expected and the actual string before the constraint is evaluated
Remarks
the strings can use the same placeholders which are used for the Framework.System.StringFormatter.Format(string format, System.Collections.Generic.IDictionary<string,object> values) method.

◆ EqualStringsConstraint() [3/3]

Joutsen.NUnit3.EqualStringsConstraint.EqualStringsConstraint ( String  expected,
object  parameter 
)

Creates a new instance of the constraint.

Parameters
expectedthe expected string value that will be used when the constraint is evaluated
parameteran object whose properties serve as name value pairs which are used to format the expected and the actual string before the constraint is evaluated
Remarks
The strings can use the same placeholders which are used for the M:Framework.System.StringFormatter.Format(string format, object values) method.

Member Function Documentation

◆ ApplyTo< TActual >()

override ConstraintResult Joutsen.NUnit3.EqualStringsConstraint.ApplyTo< TActual > ( TActual  actual)

Applies the constraint to the actual value.

Template Parameters
TActualthe type of the actual value
Parameters
actualthe value to test the constraint against
Returns
the result of the constraint evaluation

Property Documentation

◆ CaseInsensitive

bool Joutsen.NUnit3.EqualStringsConstraint.CaseInsensitive
get

Determines wether the evaluation should ignore the case of the strings characters.

◆ ClipStrings

bool Joutsen.NUnit3.EqualStringsConstraint.ClipStrings
get

Determines wether whitespaces should be removed from the start and end of the actual string before the evaluation of the constraint.

◆ Description

override string Joutsen.NUnit3.EqualStringsConstraint.Description
get

Provide a description of the constraint for messages.

◆ IgnoreCase

EqualStringsConstraint Joutsen.NUnit3.EqualStringsConstraint.IgnoreCase
get

Creates a constraint that will ignore the case of the compared strings.

Remarks
Usually the constraint modifies and returns itself.

◆ IgnoreLineBreaks

EqualStringsConstraint Joutsen.NUnit3.EqualStringsConstraint.IgnoreLineBreaks
get

Creates a constraint that will ignore the line breaks of the compared strings.

Remarks
Usually the constraint modifies and returns itself.

◆ NoClip

EqualStringsConstraint Joutsen.NUnit3.EqualStringsConstraint.NoClip
get

Creates a constraint that will not remove the whitespaces from the beginning and end of the strings.

Remarks
Usually the constraint modifies and returns itself.

◆ WithLineBreaks

bool Joutsen.NUnit3.EqualStringsConstraint.WithLineBreaks
get

Determines whether line breaks should be removed from the actual string before the evaluation of the constraint.