Closed edyoung closed 7 months ago
That's a very broad question, but a few tips:
ArbMap.Default.GeneratorFor<(int, string)>
or more complicated types that FsCheck knows how to generate directly. There' sno need to build those up from scratch with Zip
etc as you're doing.Arb.Convert
Sample
, this reads a bit better in C#. If there's one that doesn't exist and you'd like it, open an issue :)Arbitrary
directly, instead of going via generators. This isn't always possible. E.g. use ArbMap.Default.ArbFor<T>
.Prop.ForAll
API you will use to write some actual tests.Merge
is a new type to Arbitrary
map. This line: ArbMap.Default.Merge<MyArbitraries>();
doesn't do anything, since you don't use the result.T
type recursively, consider letting FsCheck generate a list of pairs of random length, and then linking those together.@edyoung can you share where you landed on this and/or close it please? Kurt's advice is excellent, but I'm not sure this is an actionable issue as it stands, and such issues are a both a tax on the maintainer, and other users.
I intended it as a discussion rather than an issue
Hi,
I'm new to FsCheck (awesome project!). This is a request for guidance rather than a bug report. I would like to test a C# API which takes as input objects with many fields, some of which are other nested objects, and use FsCheck to generate different inputs. This is using 3.0 RC1.
I have this so far, which appears to work but is a bit cumbersome, and would be worse with more properties. How can this be written more cleanly?