AssertExpectation Module
Builders and combinators for reusable assertion semantics.
Functions and values
| Function or value |
Description
|
Full Usage:
AssertExpectation.``not`` expectation
Parameters:
AssertExpectation<'T>
-
The expectation to invert.
Returns: AssertExpectation<'T>
An expectation that succeeds exactly when expectation would fail.
|
Negates an existing expectation.
|
Full Usage:
AssertExpectation.all expectations
Parameters:
AssertExpectation<'T> seq
-
The expectations to combine.
Returns: AssertExpectation<'T>
An expectation that succeeds only when every supplied expectation succeeds.
|
Combines a sequence of expectations so that all of them must succeed.
Example
|
Full Usage:
AssertExpectation.andAlso a b
Parameters:
AssertExpectation<'T>
-
The first required expectation.
b : AssertExpectation<'T>
-
The second required expectation.
Returns: AssertExpectation<'T>
An expectation that succeeds only when both input expectations succeed.
|
Combines two expectations so that both must succeed.
|
Full Usage:
AssertExpectation.any expectations
Parameters:
AssertExpectation<'T> seq
-
The expectations to combine.
Returns: AssertExpectation<'T>
An expectation that succeeds when any supplied expectation succeeds.
|
Combines a sequence of expectations so that at least one of them must succeed.
|
Full Usage:
AssertExpectation.between lowerBound upperBound
Parameters:
'T
-
The inclusive lower bound.
upperBound : 'T
-
The inclusive upper bound.
Returns: AssertExpectation<'T>
An expectation that succeeds when the value lies within the supplied range.
|
Builds an expectation that checks whether a value lies between two inclusive bounds.
|
Full Usage:
AssertExpectation.contains expectedItem
Parameters:
'T
-
The item that must be present in the sequence.
Returns: AssertExpectation<'T seq>
An expectation for containment checks.
|
Builds an expectation that checks whether a sequence contains a specific item.
|
Full Usage:
AssertExpectation.doesNotThrow
Returns: AssertExpectation<'T>
An expectation for successful synchronous evaluation.
|
Builds an expectation that succeeds when evaluation completes without throwing.
|
Full Usage:
AssertExpectation.doesNotThrowAsync
Returns: AssertExpectation<'T>
An expectation for successful asynchronous evaluation.
|
Builds an expectation that succeeds when an async or task-based expression completes without throwing.
|
Full Usage:
AssertExpectation.endsWith suffix
Parameters:
string
-
The required suffix.
Returns: AssertExpectation<string>
An expectation for suffix-based string assertions.
|
Builds an expectation that checks whether a string ends with a suffix.
|
Full Usage:
AssertExpectation.equalBy projection expected
Parameters:
'T -> 'Key
-
The projection used to derive the comparison key from both values.
expected : 'T
-
The full expected value whose projected key must match the observed one.
Returns: AssertExpectation<'T>
An expectation that compares the projected keys using F# equality.
|
Builds an equality expectation after projecting both the observed and expected values.
Example
type Person =
{
Name: string
Age: int
}
Multiple items
val string: value: 'T -> string -------------------- type string = System.String Multiple items
val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int |
Full Usage:
AssertExpectation.equalByKey projection expectedKey
Parameters:
'T -> 'Key
-
The projection used to derive the comparison key from the observed value.
expectedKey : 'Key
-
The projected key that the observed value must match.
Returns: AssertExpectation<'T>
An expectation that compares the projected key using F# equality.
|
Builds an equality expectation after projecting the observed value to a comparison key.
Example
module String
from Microsoft.FSharp.Core
val length: str: string -> int
|
Full Usage:
AssertExpectation.equalTo expected
Parameters:
'T
-
The value the observed result must equal.
Returns: AssertExpectation<'T>
An expectation that uses F# equality for the comparison.
|
Builds an expectation that checks equality with a fixed expected value.
Example
|
Full Usage:
AssertExpectation.equalToWithDiff diffOptions expected
Parameters:
DiffOptions
-
The diff configuration to use when formatting a mismatch.
expected : 'T
-
The value the observed result must equal.
Returns: AssertExpectation<'T>
An expectation that uses F# equality and enriched diff output.
|
Builds an equality expectation that uses the supplied diff options when a mismatch is rendered.
|
Full Usage:
AssertExpectation.equalWith comparer expected
Parameters:
'T -> 'T -> bool
-
The comparison function used to compare the observed and expected values.
expected : 'T
-
The value the observed result must match according to comparer.
Returns: AssertExpectation<'T>
An expectation that delegates equality to the supplied comparer.
|
Builds an equality expectation using a custom comparison function.
Example
type Person =
{
Name: string
Age: int
}
Multiple items
val string: value: 'T -> string -------------------- type string = System.String Multiple items
val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int |
Full Usage:
AssertExpectation.greaterThan expected
Parameters:
'T
-
The exclusive lower bound.
Returns: AssertExpectation<'T>
An expectation that succeeds when the value is greater than expected.
|
Builds an expectation that checks whether a value is greater than a bound.
|
Full Usage:
AssertExpectation.greaterThanOrEqualTo expected
Parameters:
'T
-
The inclusive lower bound.
Returns: AssertExpectation<'T>
An expectation that succeeds when the value is greater than or equal to
expected.
|
Builds an expectation that checks whether a value is greater than or equal to a bound.
|
Full Usage:
AssertExpectation.hasLength expectedLength
Parameters:
int
-
The required number of elements.
Returns: AssertExpectation<'T seq>
An expectation for sequence length checks.
|
Builds an expectation that checks whether a sequence has a specific length.
|
Full Usage:
AssertExpectation.isError
Returns: AssertExpectation<Result<'T, 'TError>>
An expectation for failing Result values.
|
Builds an expectation that requires a result value to be
|
Full Usage:
AssertExpectation.isFalse
Returns: AssertExpectation<bool>
An expectation for falsy boolean assertions.
|
Builds an expectation that requires a boolean value to be
|
Full Usage:
AssertExpectation.isNone
Returns: AssertExpectation<'T option>
An expectation for missing option values.
|
Builds an expectation that requires an option to be
|
Full Usage:
AssertExpectation.isOk
Returns: AssertExpectation<Result<'T, 'TError>>
An expectation for successful Result values.
|
Builds an expectation that requires a result value to be
|
Full Usage:
AssertExpectation.isSome
Returns: AssertExpectation<'T option>
An expectation for present option values.
|
Builds an expectation that requires an option to be
|
Full Usage:
AssertExpectation.isTrue
Returns: AssertExpectation<bool>
An expectation for truthy boolean assertions.
|
Builds an expectation that requires a boolean value to be
|
Full Usage:
AssertExpectation.lessThan expected
Parameters:
'T
-
The exclusive upper bound.
Returns: AssertExpectation<'T>
An expectation that succeeds when the value is smaller than expected.
|
Builds an expectation that checks whether a value is less than a bound.
|
Full Usage:
AssertExpectation.lessThanOrEqualTo expected
Parameters:
'T
-
The inclusive upper bound.
Returns: AssertExpectation<'T>
An expectation that succeeds when the value is smaller than or equal to
expected.
|
Builds an expectation that checks whether a value is less than or equal to a bound.
|
Full Usage:
AssertExpectation.notEqualTo expected
Parameters:
'T
-
The value the observed result must not equal.
Returns: AssertExpectation<'T>
An expectation that succeeds when the observed value differs from expected.
|
Builds an expectation that checks inequality against a fixed value.
|
Full Usage:
AssertExpectation.orElse a b
Parameters:
AssertExpectation<'T>
-
The first alternative expectation.
b : AssertExpectation<'T>
-
The second alternative expectation.
Returns: AssertExpectation<'T>
An expectation that succeeds when either input expectation succeeds.
|
Combines two expectations so that either one may succeed.
|
Full Usage:
AssertExpectation.satisfy description predicate
Parameters:
string
-
A short human-readable description of the expected behavior.
predicate : 'T -> bool
-
The predicate that must return true for successful observed values.
Returns: AssertExpectation<'T>
A reusable expectation based on the supplied predicate.
|
Builds an expectation from a predicate over successful values.
Use
|
Full Usage:
AssertExpectation.satisfyObserved description predicate
Parameters:
string
-
A short human-readable description of the expected behavior.
predicate : Observed<'T> -> bool
-
The predicate that receives the full Observed value, including exceptions.
Returns: AssertExpectation<'T>
A reusable expectation based on the supplied observed-result predicate.
|
Builds an expectation from a predicate over the fully observed result. This is the most flexible expectation builder because it can inspect both returned values and thrown exceptions.
|
Full Usage:
AssertExpectation.sequenceEqual expected
Parameters:
'T seq
-
The expected sequence contents.
Returns: AssertExpectation<'T seq>
An expectation for sequence equality.
|
Builds an expectation that checks whether two sequences have the same elements in the same order.
|
Full Usage:
AssertExpectation.startsWith prefix
Parameters:
string
-
The required prefix.
Returns: AssertExpectation<string>
An expectation for prefix-based string assertions.
|
Builds an expectation that checks whether a string starts with a prefix.
|
Full Usage:
AssertExpectation.throws
Returns: AssertExpectation<'T>
An expectation that checks the thrown exception type.
|
Builds an expectation that succeeds when evaluation throws a specific exception type.
Example
Multiple items
val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int namespace System
Multiple items
type DivideByZeroException = inherit ArithmeticException new: unit -> unit + 2 overloads <summary>The exception that is thrown when there is an attempt to divide an integral or <see cref="T:System.Decimal" /> value by zero.</summary> -------------------- System.DivideByZeroException() : System.DivideByZeroException System.DivideByZeroException(message: string) : System.DivideByZeroException System.DivideByZeroException(message: string, innerException: exn) : System.DivideByZeroException |
Full Usage:
AssertExpectation.throwsAny
Returns: AssertExpectation<'T>
An expectation for exception-based assertions.
|
Builds an expectation that succeeds when evaluation throws any exception.
|
Full Usage:
AssertExpectation.throwsAsync
Returns: AssertExpectation<'T>
An expectation that checks the thrown asynchronous exception type.
|
Builds an expectation that succeeds when an async or task-based expression throws a specific exception type.
|
testify