AutoFixture 3.18 introduces a new glue library called Idioms.FsCheck.
It uses FsCheck to implement a reusable assertion that verifies (or at least, makes probable) that a method doesn’t return null:
How it works
If a method is parameterless the assertion simply exercises its return value by invoking it. Otherwise, its return value is exercised against arbitrary values generated by FsCheck.
An injected instance of an
ISpecimenBuilder (e.g. a
Fixture instance) creates instances of the type containing the method if it’s declared as an instance method.
- Idioms.FsCheck’s test suite contains examples in F#.
- The original question on Stack Overflow that triggered this feature includes examples in C#.
Idioms.FsCheck is available on NuGet: