MisterJames / GenFu

GenFu is a library you can use to generate realistic test data. It is composed of several property fillers that can populate commonly named properties through reflection using an internal database of values or randomly created data. You can override any of the fillers, give GenFu hints on how to fill them.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to fill bool property with default value

vabic opened this issue · comments

Ex:

    class User
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public IsActive { get; set; } = true;
    }
           GenFu.Configure<User>()
                .Fill(g => g.FirstName , () => $"FirstName-{Guid.NewGuid()}")
                .Fill(g => g.LastName , () => $"LastName -{Guid.NewGuid()}")
                .Fill(g => g.IsActive).WithRandom(new [] {true, false});

var users = A.ListOf<User>(20);

All users have the IsActive property set to default value (IsActive == true);
In debug, the setter property are never called.