Class MaybeAssertions<T>
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
maybeMaybe<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
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
becausestringA formatted phrase explaining why the assertion is needed.
becauseArgsobject[]Zero or more objects to format using the placeholders in
because.
Returns
HaveValue(string, params object[])
Asserts that the Maybe has a value.
public AndWhichConstraint<MaybeAssertions<T>, T> HaveValue(string because = "", params object[] becauseArgs)
Parameters
becausestringA formatted phrase explaining why the assertion is needed.
becauseArgsobject[]Zero or more objects to format using the placeholders in
because.
Returns
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
expectedValueTThe expected value.
becausestringA formatted phrase explaining why the assertion is needed.
becauseArgsobject[]Zero or more objects to format using the placeholders in
because.
Returns
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
expectedValueTThe expected value.
becausestringA formatted phrase explaining why the assertion is needed.
becauseArgsobject[]Zero or more objects to format using the placeholders in
because.
Returns
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
predicateFunc<T, bool>The predicate the value should satisfy.
becausestringA formatted phrase explaining why the assertion is needed.
becauseArgsobject[]Zero or more objects to format using the placeholders in
because.