Table of Contents

Class MaybeAssertions<T>

Namespace
Trellis.Testing
Assembly
Trellis.Testing.dll

Contains assertion methods for Maybe types.

public class MaybeAssertions<T> : ReferenceTypeAssertions<Maybe<T>, MaybeAssertions<T>> where T : notnull

Type Parameters

T
Inheritance
MaybeAssertions<T>
Inherited Members
Extension Methods

Constructors

MaybeAssertions(Maybe<T>)

Initializes a new instance of the MaybeAssertions<T> class.

public MaybeAssertions(Maybe<T> maybe)

Parameters

maybe Maybe<T>

Properties

Identifier

Returns the type of the subject the assertion applies on. It should be a user-friendly name as it is included in the failure message.

protected override string Identifier { get; }

Property Value

string

Methods

BeNone(string, params object[])

Asserts that the Maybe has no value (is None).

public AndConstraint<MaybeAssertions<T>> BeNone(string because = "", params object[] becauseArgs)

Parameters

because string

A formatted phrase explaining why the assertion is needed.

becauseArgs object[]

Zero or more objects to format using the placeholders in because.

Returns

AndConstraint<MaybeAssertions<T>>

HaveValue(string, params object[])

Asserts that the Maybe has a value.

public AndWhichConstraint<MaybeAssertions<T>, T> HaveValue(string because = "", params object[] becauseArgs)

Parameters

because string

A formatted phrase explaining why the assertion is needed.

becauseArgs object[]

Zero or more objects to format using the placeholders in because.

Returns

AndWhichConstraint<MaybeAssertions<T>, T>

HaveValueEqualTo(T, string, params object[])

Asserts that the Maybe has a value equal to the expected value.

public AndConstraint<MaybeAssertions<T>> HaveValueEqualTo(T expectedValue, string because = "", params object[] becauseArgs)

Parameters

expectedValue T

The expected value.

because string

A formatted phrase explaining why the assertion is needed.

becauseArgs object[]

Zero or more objects to format using the placeholders in because.

Returns

AndConstraint<MaybeAssertions<T>>

HaveValueEquivalentTo(T, string, params object[])

Asserts that the Maybe has a value that is equivalent to the expected value using structural comparison.

public AndConstraint<MaybeAssertions<T>> HaveValueEquivalentTo(T expectedValue, string because = "", params object[] becauseArgs)

Parameters

expectedValue T

The expected value.

because string

A formatted phrase explaining why the assertion is needed.

becauseArgs object[]

Zero or more objects to format using the placeholders in because.

Returns

AndConstraint<MaybeAssertions<T>>

HaveValueMatching(Func<T, bool>, string, params object[])

Asserts that the Maybe has a value that satisfies the given predicate.

public AndConstraint<MaybeAssertions<T>> HaveValueMatching(Func<T, bool> predicate, string because = "", params object[] becauseArgs)

Parameters

predicate Func<T, bool>

The predicate the value should satisfy.

because string

A formatted phrase explaining why the assertion is needed.

becauseArgs object[]

Zero or more objects to format using the placeholders in because.

Returns

AndConstraint<MaybeAssertions<T>>