I have the following code:
var gen = from x in Arb.Generate<int>()
from int y in Gen.Choose(5, 10)
where x > 5
select new tuple { Fst = x, Snd = y };
And I can run
Prop.ForAll<tuple>(c =>
Console.WriteLine($"{c.Fst}, {c.Snd}")
).Check(Configuration.Default);
I see all the ways to construct generators and define properties.
But I just don't find quickly enough how to use them together.
You need to register the custom generator with FsCheck. See FSCheck docs.
In short, create a class to keep your custom generators. Have a public static method returning an
Arbitrary<T>
whereT
is the type you are generating.In your example, you would need to wrap your generator in a call to
Arb.From(...)
.Finally, call
Arb.Register<MyGenerators>()
before running your test.