Код: Выделить всё
public class Plan
{
public DateOnly Date { get; set; }
public TimeOnly StartTime { get; set; }
public TimeOnly EndTime { get; set; }
public Guid EmployeeId { get; set; }
}
public class Employee
{
public ICollection? shifts { get; set; }
}
[Fact]
private async Task Handle_ShiftServiceTests_Valid()
{
var shifts = new AutoFaker()
.RuleFor(x => x.Date, new DateOnly(2025, 03, 1))
.RuleFor(x => x.StartTime, TimeOnly.FromDateTime(DateTime.Now))
.RuleFor(x => x.EndTime, TimeOnly.FromDateTime(DateTime.Now))
.Generate(1);
var worker = new AutoFaker()
.RuleFor(a => a.shifts, shifts)
.Generate();
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... e-datetime
Мобильная версия