C# Class NFluent.Extensibility.FluentMessage

Help to build a properly formatted fluent error message.
Show file Open project: tpierrain/NFluent Class Usage Examples

Private Properties

Property Type Description
FluentMessage System

Public Methods

Method Description
BuildMessage ( string message ) : FluentMessage

Builds the message.

Expected ( object expected ) : MessageBlock

Adds a message block to describe the expected result.

ExpectedType ( Type expectedType ) : MessageBlock

Adds a message block to describe the expected type.

ExpectedValues ( object expectedValues ) : MessageBlock

Adds a message block to describe the expected values.

For ( Type forcedType ) : FluentMessage

Specifies the type of entities.

For ( string newEntityDescription ) : FluentMessage

Specifies the attribute to use to describe entities.

On ( object test, int index ) : MessageBlock

Adds a block describing the checked objet.

ReferenceValues ( object expected ) : MessageBlock

Adds a message block to describe the expected result.

ToString ( ) : string

Returns a System.String that represents this instance.

WithGivenValue ( object givenValue ) : MessageBlock

Adds a message block to describe the given value (usually used as an alternative to the Expected block).

Private Methods

Method Description
FluentMessage ( string message ) : System

Initializes a new instance of the FluentMessage class.

You can use {x} as place holders for standard wordings: - {0}.

Method Details

BuildMessage() public static method

Builds the message.
public static BuildMessage ( string message ) : FluentMessage
message string The message.
return FluentMessage

Expected() public method

Adds a message block to describe the expected result.
public Expected ( object expected ) : MessageBlock
expected object The expected value.
return MessageBlock

ExpectedType() public method

Adds a message block to describe the expected type.
public ExpectedType ( Type expectedType ) : MessageBlock
expectedType System.Type The expected type.
return MessageBlock

ExpectedValues() public method

Adds a message block to describe the expected values.
public ExpectedValues ( object expectedValues ) : MessageBlock
expectedValues object The expected values.
return MessageBlock

For() public method

Specifies the type of entities.
public For ( Type forcedType ) : FluentMessage
forcedType System.Type The type of the Entity.
return FluentMessage

For() public method

Specifies the attribute to use to describe entities.
public For ( string newEntityDescription ) : FluentMessage
newEntityDescription string The new description for the Entity.
return FluentMessage

On() public method

Adds a block describing the checked objet.
public On ( object test, int index ) : MessageBlock
test object The tested object/value.
index int The interesting index (for enumerable types)
return MessageBlock

ReferenceValues() public method

Adds a message block to describe the expected result.
public ReferenceValues ( object expected ) : MessageBlock
expected object The expected value.
return MessageBlock

ToString() public method

Returns a System.String that represents this instance.
public ToString ( ) : string
return string

WithGivenValue() public method

Adds a message block to describe the given value (usually used as an alternative to the Expected block).
public WithGivenValue ( object givenValue ) : MessageBlock
givenValue object The given value.
return MessageBlock