31

I'm using c# Bogus.Faker library to create random test data for my unit tests.
I want to know how to easily pick a random enum value ?

Any suggestions?

hannes neukermans
  • 12,017
  • 7
  • 37
  • 56

1 Answers1

44

Found the solution:
You have to use Faker.PickRandom<> method

i.TypeOfSchedule = Faker.PickRandom<Schedule>(); // with 'Schedule' of type Enum :-)
hannes neukermans
  • 12,017
  • 7
  • 37
  • 56