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.
Other
831 stars 100 forks source link

How to fill bool property with default value #172

Open vabic opened 2 years ago

vabic commented 2 years ago

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.

vaishnavi-2901 commented 4 months ago

hey, can you assign this to me?