Suppose I have an interface IPerson with 2 read properties age (int) and name (string).
I also have a class Person implementing IPerson.
How do I write a FsCheck generator for generating instances of IPerson type?
Suppose I have an interface IPerson with 2 read properties age (int) and name (string).
I also have a class Person implementing IPerson.
How do I write a FsCheck generator for generating instances of IPerson type?
Something like the below should work:
Gen<IPerson> gen = from age in Arb.Default.Int32().Generator
from name in Arb.Default.String().Generator
select new Person(age, name) as IPerson;
© 2022 - 2024 — McMap. All rights reserved.