最后还要将自定义的Arbitrary注册在FsCheck中:
public class MyGenerators { public static Arbitrary<User> User() { return new UserArbitrary(); } } Arb.Register<MyGenerators>();写个例子试试:
[Property] public bool GenerateUsers(User user) { return user.Name != string.Empty; }所以代码实例均可以在https://github.com/twzhangyang/FsCheck.Practice下载