Add support for NodaTime to Bogus.
See Milestones for release notes.
https://nuget.org/packages/NodaTime.Bogus/
This project extends Faker
with .Noda()
.
var faker = new Faker<Target>()
.RuleFor(u => u.Property1, (f, _) => f.Noda().Duration())
.RuleFor(u => u.Property2, (f, _) => f.Noda().Instant.Recent())
.RuleFor(u => u.Property3, (f, _) => f.Noda().ZonedDateTime.Future());
var target = faker.Generate();
Debug.WriteLine(target.Property1);
Debug.WriteLine(target.Property2);
Debug.WriteLine(target.Property3);
There are several top level generators:
CalendarSystem()
: Creates a random CalendarSystem.DateTimeZone()
: Creates a random DateTimeZone.Duration()
: Creates a random Duration.IsoDayOfWeek()
: Creates a random IsoDayOfWeek.Offset()
: Creates a random Offset.Period()
: Creates a random Period.PeriodUnits()
: Creates a random PeriodUnits.
There are several nested generators that provide Past
, Soon
, Future
, Between
, and Recent
semantics:
.Instant
: Generators for Instant.LocalDate
: Generators for LocalDate.LocalDateTime
: Generators for LocalDateTime.LocalTime
: Generators for LocalTime.ZonedDateTime
: Generators for ZonedDateTime
Calendar designed by Monster Critic from The Noun Project.