Skip to content

Self-reference gen factories #339

Description

@nth-commit

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions