Joutsen  v0.4.1
Classes | Public Member Functions | Properties | List of all members
Joutsen.NUnit3.EqualPropertiesConstraint Class Reference

A nunit constraint which offers object comparison by the classes public properties. More...

Classes

class  EqualPropertiesConstraintResult
 A class representing the result of a EqualPropertiesConstraint. More...
 

Public Member Functions

 EqualPropertiesConstraint (object expected)
 Creates a new instance for an expectd object. More...
 
 EqualPropertiesConstraint (object expected, params string[] ignoredProperties)
 Creates a new instance with names of properties to ignore for the comparison. More...
 
EqualPropertiesConstraint IgnoringProperties (params String[] ignoredProperties)
 Changes the properties which should be ignored when the objects are compared. More...
 
override ConstraintResult ApplyTo< TActual > (TActual actual)
 Applies the constraint to the actual value. More...
 

Properties

override string Description [get]
 Provide a description of the constraint for messages. More...
 

Detailed Description

A nunit constraint which offers object comparison by the classes public properties.

Remarks
Using this constraint two objects are considered to be equal if their public properties are equal. Properies which are enumerable are checked in the same way by comparing the properties of the items the enumerable produces. In all cases indexer proeprties are ignored.
Since
0.2.1

Constructor & Destructor Documentation

◆ EqualPropertiesConstraint() [1/2]

Joutsen.NUnit3.EqualPropertiesConstraint.EqualPropertiesConstraint ( object  expected)

Creates a new instance for an expectd object.

Parameters
expectedthe expected object used for comparison of the properties.

◆ EqualPropertiesConstraint() [2/2]

Joutsen.NUnit3.EqualPropertiesConstraint.EqualPropertiesConstraint ( object  expected,
params string []  ignoredProperties 
)

Creates a new instance with names of properties to ignore for the comparison.

Parameters
expectedthe expected object used for comparison of the properties.
ignoredPropertiesThe names of the properties which should be ignored when comparing the two objects.

Member Function Documentation

◆ ApplyTo< TActual >()

override ConstraintResult Joutsen.NUnit3.EqualPropertiesConstraint.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

◆ IgnoringProperties()

EqualPropertiesConstraint Joutsen.NUnit3.EqualPropertiesConstraint.IgnoringProperties ( params String []  ignoredProperties)

Changes the properties which should be ignored when the objects are compared.

Parameters
ignoredPropertiesthe names of the properties which should be ignored when comparing the two objects
Returns
the constraint. This is useful for method chaining

Property Documentation

◆ Description

override string Joutsen.NUnit3.EqualPropertiesConstraint.Description
get

Provide a description of the constraint for messages.