GalaxyCheck
GalaxyCheck copied to clipboard
Self-reference gen factories
Discovered while using GalaxyCheck in another project.
public record MyRecord(string A, string B);
public static readonly IGenFactory DefaultGenFactory = Gen
.Factory()
.RegisterType(String)
.RegisterType(DefaultGenFactory
.Create<MyRecord>()
.OverrideMember(x => x.A, Gen.Constant("a")));
I want strings to have some default semantics (e.g. only alpha-numeric), but I want the property A to have its own semantics.
This code obviously doesn't work, because DefaultGenFactory is not defined at the place it's used.
Need to add registration methods that take the factory as a callback.