Completes the scheduler module coverage with a startup theme bootstrap and a stubbed cycle ticker

This commit is contained in:
BinaryAlley committed 2026-09-05 01:40:15 -07:00
1 parent 4b7cfbbe11
commit 315aed90f0
59 files changed
+5152 -65

No files matched your search

@@ -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())];
}
}
@@ -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())];
}
}
@@ -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())];
}
}
@@ -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())];
}
}
@@ -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())];
}
}
@@ -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())];
}
}
@@ -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())];
}
}