Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 c# Bogus.Faker 库为我的单元测试创建随机测试数据。 我想知道如何轻松选择随机枚举值?
有什么建议么?
找到解决方案:您必须使用Faker.PickRandom<>方法
i.TypeOfSchedule = Faker.PickRandom<Schedule>(); // with 'Schedule' of type Enum :-)