Shouldly
  • Overview
  • Contributing
  • Documentation
    • Getting Started
    • Configuration
    • Equality
      • ShouldBe
      • NotBe
      • Null
      • Bool
      • Flags
      • AssignableTo
      • OfType
      • OneOf
      • Greater/Less Than
      • InRange
      • MatchApproved
      • Enumerable
      • SameAs
      • String
      • ExampleClasses
    • String
      • ShouldBe
      • Match
      • Contain
      • Null and Empty
      • StartWith
      • EndWith
    • Enumerable
      • ShouldBe
      • All
      • Empty
      • OneOf
      • Contain
      • Unique
      • SubsetOf
      • Have
    • Dictionary
      • ContainKey
      • ContainKeyAndValue
    • Exceptions
      • Throw
      • NotThrow
    • SatisfyAllConditions
    • CompleteIn
    • DynamicShould
    • Upgrade 3 to 4
Powered by GitBook
On this page
  • DefaultFloatingPointTolerance
  • DefaultTaskTimeout
  • CompareAsObjectTypes
Edit on GitHub
  1. Documentation

Configuration

Shouldly has a few configuration options:

DefaultFloatingPointTolerance

Allows specifying a floating point tolerance for all assertions

Default value: 0.0d

DefaultTaskTimeout

Should.Throw(Func<Task>) blocks, the timeout is a safeguard for deadlocks.

Shouldly runs the lambda without a synchronisation context, but deadlocks are still possible. Use Should.ThrowAsync to be safe then await the returned task to prevent possible deadlocks.

Default value: 10 seconds

CompareAsObjectTypes

Types which also are IEnumerable of themselves.

An example is Newtonsoft.Json.Linq.JToken which looks like this class JToken : IEnumerable<JToken>.

Default value: Newtonsoft.Json.Linq.JToken

PreviousGetting StartedNextEquality

Last updated 2 years ago