Skip to main content

Customization

You can customize certain behavior or specify default values to use globally.

All customizations are located in the static Customize.aweXpect class. Customization values are grouped and have a dedicated Get and Set method. The Set method always returns a lifetime scope which is an IDisposable object that will revert the customization value to its previous value upon disposal.

The customization options are applied in an async context which means, that they don't directly influence other parallel tests.

Formatting

Under Customize.aweXpect.Formatting() you have:

  • MaximumNumberOfCollectionItems
    The maximum number of displayed items in a collection.

  • MinimumNumberOfCharactersAfterStringDifference
    The minimum number of characters included after the first mismatch in the string difference.

Json

Under Customize.aweXpect.Json() you have:

  • DefaultJsonDocumentOptions
    The default options used to parse a JsonDocument.

  • DefaultJsonSerializerOptions
    The default options used for the JsonSerializer.

Reflection

Under Customize.aweXpect.Reflection() you have:

  • ExcludedAssemblyPrefixes
    The assembly namespace prefixes that are excluded during reflection.

Settings

Under Customize.aweXpect.Settings() you have:

  • TestCancellation
    A cancellation logic that is applied for all test. This can be one of the following:

    • FromTimeout(TimeSpan timeout)
      This will cancel the CancellationToken that is used internally and forwarded to the delegates after the given timeout.
    • FromCancellationToken(Func<CancellationToken> cancellationTokenFactory)
      This will use the returned CancellationToken internally and also forward it to the delegates.
  • DefaultCheckInterval
    The default interval for repeatedly checking the condition on an object.

  • DefaultSignalerTimeout
    The default timeout for the Signaler.

  • DefaultTimeComparisonTolerance
    The default tolerance for time comparisons. Note: In Windows the DateTime resolution is about 10 to 15 milliseconds