Skip to content

[Bug]: FsCheck Custom Generators Example from Doc is not working #4619

@Genmutant

Description

@Genmutant

Description

Using the Custom Generators Example from the documentation doesn't compile:

public class PositiveIntArbitrary
{
    public static Arbitrary<int> PositiveInt()
    {
        return Arb.Default.Int32().Filter(x => x > 0);
    }
}

There are two options to import Arb from, either from FsCheck.FSharp or FsCheck.Fluent - but both Arb classes contain a property / inner class Default. I only found this class, but that seems non accessible for us.

I also found no use of custom Arbitrary in the tests of TUnit.FsCheck, so I couldn't compare what was wrong.

In my case I solved the problem by using NonEmptyString instead of the normal string parameter, which is of course better than writing customs anyway.

Expected Behavior

The example code compiles and the classes are found.

Actual Behavior

The example code doesn't compile, as Default is not found.

Steps to Reproduce

Copy the example code to a new test and try to import the correct Arb class.

TUnit Version

1.12.93

.NET Version

.NET 10

Operating System

Windows

IDE / Test Runner

JetBrains Rider

Error Output / Stack Trace

5>TestTest.cs(13,24): Error CS0117 : "Arb" enthält keine Definition für "Default".

Additional Context

No response

IDE-Specific Issue?

  • I've confirmed this issue occurs when running via dotnet test or dotnet run, not just in my IDE

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions