mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 19:21:10 +00:00
Completes the scheduler module coverage with a startup theme bootstrap and a stubbed cycle ticker
This commit is contained in:
1 parent
4b7cfbbe11
commit
315aed90f0
59 files changed
+5152
-65
No files matched your search
+71
@@ -0,0 +1,71 @@
|
||||
#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;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="ScheduledJobDto"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ScheduledJobDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ScheduledJobDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional unique identifier of the scheduled job.</param>
|
||||
/// <param name="name">Optional name of the scheduled job.</param>
|
||||
/// <param name="taskType">Optional type of the task executed by the scheduled job.</param>
|
||||
/// <param name="scheduleType">Optional type of the schedule of the scheduled job.</param>
|
||||
/// <param name="intervalMinutes">Optional interval in minutes of the schedule of the scheduled job.</param>
|
||||
/// <param name="hour">Optional hour of the schedule of the scheduled job.</param>
|
||||
/// <param name="minute">Optional minute of the schedule of the scheduled job.</param>
|
||||
/// <param name="status">Optional status of the scheduled job.</param>
|
||||
/// <param name="lastStartedOnUtc">Optional date and time when the task of the scheduled job last started its execution.</param>
|
||||
/// <param name="lastCompletedOnUtc">Optional date and time when the task of the scheduled job last completed its execution.</param>
|
||||
/// <returns>A configured <see cref="ScheduledJobDto"/> instance.</returns>
|
||||
public ScheduledJobDto Create(
|
||||
Guid? id = null,
|
||||
string? name = null,
|
||||
ScheduledTaskType? taskType = null,
|
||||
ScheduleType? scheduleType = null,
|
||||
int? intervalMinutes = null,
|
||||
int? hour = null,
|
||||
int? minute = null,
|
||||
ScheduledJobStatus? status = null,
|
||||
DateTime? lastStartedOnUtc = null,
|
||||
DateTime? lastCompletedOnUtc = null)
|
||||
{
|
||||
ScheduleType resolvedScheduleType = scheduleType ?? _faker.PickRandom<ScheduleType>();
|
||||
DateTime? resolvedLastCompletedOnUtc = lastCompletedOnUtc ?? _faker.Date.Recent(10);
|
||||
return new ScheduledJobDto(
|
||||
Id: id ?? Guid.NewGuid(),
|
||||
Name: name ?? _faker.Name.JobTitle(),
|
||||
TaskType: taskType ?? _faker.PickRandom<ScheduledTaskType>(),
|
||||
ScheduleType: resolvedScheduleType,
|
||||
IntervalMinutes: intervalMinutes ?? (resolvedScheduleType == ScheduleType.WithIntervalInMinutes ? _faker.Random.Int(1, 1440) : null),
|
||||
Hour: hour ?? (resolvedScheduleType == ScheduleType.DailyAtHourAndMinute ? _faker.Random.Int(0, 23) : null),
|
||||
Minute: minute ?? (resolvedScheduleType == ScheduleType.DailyAtHourAndMinute ? _faker.Random.Int(0, 59) : null),
|
||||
Status: status ?? _faker.PickRandom<ScheduledJobStatus>(),
|
||||
LastStartedOnUtc: lastStartedOnUtc ?? _faker.Date.Recent(10),
|
||||
LastCompletedOnUtc: resolvedLastCompletedOnUtc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="ScheduledJobDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="ScheduledJobDto"/> instances.</returns>
|
||||
public List<ScheduledJobDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
#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;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="ScheduledJobExecutionDto"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ScheduledJobExecutionDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ScheduledJobExecutionDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional unique identifier of the execution.</param>
|
||||
/// <param name="scheduledJobId">Optional unique identifier of the scheduled job whose task was executed.</param>
|
||||
/// <param name="taskType">Optional type of the task that was executed.</param>
|
||||
/// <param name="isCycleRun">Optional value indicating whether the execution was triggered by the execution cycle of the scheduled job.</param>
|
||||
/// <param name="startedOnUtc">Optional date and time when the execution started.</param>
|
||||
/// <param name="completedOnUtc">Optional date and time when the execution completed.</param>
|
||||
/// <returns>A configured <see cref="ScheduledJobExecutionDto"/> instance.</returns>
|
||||
public ScheduledJobExecutionDto Create(
|
||||
Guid? id = null,
|
||||
Guid? scheduledJobId = null,
|
||||
ScheduledTaskType? taskType = null,
|
||||
bool? isCycleRun = null,
|
||||
DateTime? startedOnUtc = null,
|
||||
DateTime? completedOnUtc = null)
|
||||
{
|
||||
DateTime resolvedStartedOnUtc = startedOnUtc ?? _faker.Date.Recent(10);
|
||||
return new ScheduledJobExecutionDto(
|
||||
Id: id ?? Guid.NewGuid(),
|
||||
ScheduledJobId: scheduledJobId ?? Guid.NewGuid(),
|
||||
TaskType: taskType ?? _faker.PickRandom<ScheduledTaskType>(),
|
||||
IsCycleRun: isCycleRun ?? _faker.Random.Bool(),
|
||||
StartedOnUtc: resolvedStartedOnUtc,
|
||||
CompletedOnUtc: completedOnUtc ?? _faker.Date.Soon(1, resolvedStartedOnUtc));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="ScheduledJobExecutionDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="ScheduledJobExecutionDto"/> instances.</returns>
|
||||
public List<ScheduledJobExecutionDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#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;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="SchedulerDisplayPreferencesDto"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class SchedulerDisplayPreferencesDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="SchedulerDisplayPreferencesDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="userId">Optional unique identifier of the user that owns the display preferences.</param>
|
||||
/// <param name="jobTypeFilter">Optional type of the scheduled job tasks whose executions are shown on the scheduler page.</param>
|
||||
/// <param name="displayTimeSpan">Optional time span, expressed in <paramref name="displayTimeUnit"/>, that the scheduler page shows.</param>
|
||||
/// <param name="displayTimeUnit">Optional unit in which the displayed time span of the scheduler page is expressed.</param>
|
||||
/// <returns>A configured <see cref="SchedulerDisplayPreferencesDto"/> instance.</returns>
|
||||
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<SchedulerDisplayTimeUnit>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="SchedulerDisplayPreferencesDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="SchedulerDisplayPreferencesDto"/> instances.</returns>
|
||||
public List<SchedulerDisplayPreferencesDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.Enums.Scheduling;
|
||||
using Lumina.Presentation.Web.Common.Requests.Scheduling;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="AddScheduledJobRequest"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddScheduledJobRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="AddScheduledJobRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="name">Optional name of the scheduled job.</param>
|
||||
/// <param name="taskType">Optional type of the task executed by the scheduled job.</param>
|
||||
/// <param name="scheduleType">Optional type of the schedule of the scheduled job.</param>
|
||||
/// <param name="intervalMinutes">Optional interval in minutes of the schedule, when the schedule type is <see cref="ScheduleType.WithIntervalInMinutes"/>.</param>
|
||||
/// <param name="hour">Optional hour of the schedule, when the schedule type is <see cref="ScheduleType.DailyAtHourAndMinute"/>.</param>
|
||||
/// <param name="minute">Optional minute of the schedule, when the schedule type is <see cref="ScheduleType.DailyAtHourAndMinute"/>.</param>
|
||||
/// <returns>A configured <see cref="AddScheduledJobRequest"/> instance.</returns>
|
||||
public AddScheduledJobRequest Create(
|
||||
string? name = null,
|
||||
ScheduledTaskType? taskType = null,
|
||||
ScheduleType? scheduleType = null,
|
||||
int? intervalMinutes = null,
|
||||
int? hour = null,
|
||||
int? minute = null)
|
||||
{
|
||||
ScheduleType resolvedScheduleType = scheduleType ?? _faker.PickRandom<ScheduleType>();
|
||||
return new AddScheduledJobRequest(
|
||||
Name: name ?? _faker.Name.JobTitle(),
|
||||
TaskType: taskType ?? _faker.PickRandom<ScheduledTaskType>(),
|
||||
ScheduleType: resolvedScheduleType,
|
||||
IntervalMinutes: intervalMinutes ?? (resolvedScheduleType == ScheduleType.WithIntervalInMinutes ? _faker.Random.Int(1, 1440) : null),
|
||||
Hour: hour ?? (resolvedScheduleType == ScheduleType.DailyAtHourAndMinute ? _faker.Random.Int(0, 23) : null),
|
||||
Minute: minute ?? (resolvedScheduleType == ScheduleType.DailyAtHourAndMinute ? _faker.Random.Int(0, 59) : null));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="AddScheduledJobRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="AddScheduledJobRequest"/> instances.</returns>
|
||||
public List<AddScheduledJobRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Scheduling;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="FireScheduledJobRequest"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class FireScheduledJobRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="FireScheduledJobRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="scheduledJobId">Optional unique identifier of the scheduled job whose task is fired.</param>
|
||||
/// <returns>A configured <see cref="FireScheduledJobRequest"/> instance.</returns>
|
||||
public FireScheduledJobRequest Create(
|
||||
Guid? scheduledJobId = null)
|
||||
{
|
||||
return new FireScheduledJobRequest(
|
||||
ScheduledJobId: scheduledJobId ?? Guid.NewGuid()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="FireScheduledJobRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="FireScheduledJobRequest"/> instances.</returns>
|
||||
public List<FireScheduledJobRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Scheduling;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="GetScheduledJobHistoryRequest"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetScheduledJobHistoryRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="GetScheduledJobHistoryRequest"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="from">Optional inclusive lower bound of the interval for which the history is requested.</param>
|
||||
/// <param name="to">Optional inclusive upper bound of the interval for which the history is requested.</param>
|
||||
/// <returns>A configured <see cref="GetScheduledJobHistoryRequest"/> instance.</returns>
|
||||
public GetScheduledJobHistoryRequest Create(
|
||||
DateTime? from = null,
|
||||
DateTime? to = null)
|
||||
{
|
||||
return new GetScheduledJobHistoryRequest(
|
||||
From: from,
|
||||
To: to
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="GetScheduledJobHistoryRequest"/> instances.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetScheduledJobHistoryRequest"/> instances.</returns>
|
||||
public List<GetScheduledJobHistoryRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Scheduling;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="RemoveScheduledJobRequest"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class RemoveScheduledJobRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="RemoveScheduledJobRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="scheduledJobId">Optional unique identifier of the scheduled job to remove.</param>
|
||||
/// <returns>A configured <see cref="RemoveScheduledJobRequest"/> instance.</returns>
|
||||
public RemoveScheduledJobRequest Create(
|
||||
Guid? scheduledJobId = null)
|
||||
{
|
||||
return new RemoveScheduledJobRequest(
|
||||
ScheduledJobId: scheduledJobId ?? Guid.NewGuid()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="RemoveScheduledJobRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="RemoveScheduledJobRequest"/> instances.</returns>
|
||||
public List<RemoveScheduledJobRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Scheduling;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="StartScheduledJobRequest"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class StartScheduledJobRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="StartScheduledJobRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="scheduledJobId">Optional unique identifier of the scheduled job whose execution cycle is started.</param>
|
||||
/// <returns>A configured <see cref="StartScheduledJobRequest"/> instance.</returns>
|
||||
public StartScheduledJobRequest Create(
|
||||
Guid? scheduledJobId = null)
|
||||
{
|
||||
return new StartScheduledJobRequest(
|
||||
ScheduledJobId: scheduledJobId ?? Guid.NewGuid()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="StartScheduledJobRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="StartScheduledJobRequest"/> instances.</returns>
|
||||
public List<StartScheduledJobRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Scheduling;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="StopScheduledJobRequest"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class StopScheduledJobRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="StopScheduledJobRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="scheduledJobId">Optional unique identifier of the scheduled job whose execution cycle is stopped.</param>
|
||||
/// <returns>A configured <see cref="StopScheduledJobRequest"/> instance.</returns>
|
||||
public StopScheduledJobRequest Create(
|
||||
Guid? scheduledJobId = null)
|
||||
{
|
||||
return new StopScheduledJobRequest(
|
||||
ScheduledJobId: scheduledJobId ?? Guid.NewGuid()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="StopScheduledJobRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="StopScheduledJobRequest"/> instances.</returns>
|
||||
public List<StopScheduledJobRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.Enums.Scheduling;
|
||||
using Lumina.Presentation.Web.Common.Requests.Scheduling;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="UpdateSchedulerDisplayPreferencesRequest"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateSchedulerDisplayPreferencesRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UpdateSchedulerDisplayPreferencesRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="jobTypeFilter">Optional type of the scheduled job tasks whose executions are shown on the scheduler page.</param>
|
||||
/// <param name="displayTimeSpan">Optional time span, expressed in <paramref name="displayTimeUnit"/>, that the scheduler page shows.</param>
|
||||
/// <param name="displayTimeUnit">Optional unit in which the displayed time span of the scheduler page is expressed.</param>
|
||||
/// <returns>A configured <see cref="UpdateSchedulerDisplayPreferencesRequest"/> instance.</returns>
|
||||
public UpdateSchedulerDisplayPreferencesRequest Create(
|
||||
ScheduledTaskType? jobTypeFilter = null,
|
||||
int? displayTimeSpan = null,
|
||||
SchedulerDisplayTimeUnit? displayTimeUnit = null)
|
||||
{
|
||||
return new UpdateSchedulerDisplayPreferencesRequest(
|
||||
JobTypeFilter: jobTypeFilter,
|
||||
DisplayTimeSpan: displayTimeSpan ?? _faker.Random.Int(1, 30),
|
||||
DisplayTimeUnit: displayTimeUnit ?? _faker.PickRandom<SchedulerDisplayTimeUnit>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="UpdateSchedulerDisplayPreferencesRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="UpdateSchedulerDisplayPreferencesRequest"/> instances.</returns>
|
||||
public List<UpdateSchedulerDisplayPreferencesRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user