#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Presentation.Web.Common.DTO.Scheduling;
using Lumina.Presentation.Web.Common.Enums.Scheduling;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.Scheduling;
///
/// Fixture class for the record.
///
[ExcludeFromCodeCoverage]
public class SchedulerDisplayPreferencesDtoFixture
{
private readonly Faker _faker = new();
///
/// Creates a new instance with randomized test data.
///
/// Optional unique identifier of the user that owns the display preferences.
/// Optional type of the scheduled job tasks whose executions are shown on the scheduler page.
/// Optional time span, expressed in , that the scheduler page shows.
/// Optional unit in which the displayed time span of the scheduler page is expressed.
/// A configured instance.
public SchedulerDisplayPreferencesDto Create(
Guid? userId = null,
ScheduledTaskType? jobTypeFilter = null,
int? displayTimeSpan = null,
SchedulerDisplayTimeUnit? displayTimeUnit = null)
{
return new SchedulerDisplayPreferencesDto(
UserId: userId ?? Guid.NewGuid(),
JobTypeFilter: jobTypeFilter,
DisplayTimeSpan: displayTimeSpan ?? _faker.Random.Int(1, 30),
DisplayTimeUnit: displayTimeUnit ?? _faker.PickRandom());
}
///
/// Creates multiple instances with randomized test data.
///
/// Number of instances to create.
/// List of configured instances.
public List CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}