#region ========================================================================= USING ===================================================================================== using Bogus; using Lumina.Presentation.Web.Common.DTO.Themes; using Lumina.Presentation.Web.Common.Enums.Themes; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; #endregion namespace Lumina.Presentation.Web.Fixtures.Common.DTO.Themes; /// /// Fixture class for the record. /// [ExcludeFromCodeCoverage] public class ThemeResponseDtoFixture { private readonly Faker _faker = new(); /// /// Creates a new instance with randomized test data. /// /// Optional database identifier of the theme. /// Optional manifest id of the theme. /// Optional display name of the theme. /// Optional description of the theme. /// Optional author of the theme. /// Optional semantic version of the theme. /// Optional preview image path of the theme, or when the theme has no preview. /// Optional source the theme was installed from. /// Optional value indicating whether the theme is the active one. /// Optional UTC timestamp at which the theme was installed. /// Optional value indicating whether the theme was deleted by the user. /// Whether the preview path should be included, or forced to . /// Whether the currently active flag should be included, or forced to . /// A configured instance. public ThemeResponseDto Create( Guid? id = null, string? themeId = null, string? name = null, string? description = null, string? author = null, string? version = null, string? previewPath = null, ThemeInstallSource? installSource = null, bool? isCurrent = null, DateTime? installedAtUtc = null, bool? isDeleted = null, bool includePreviewPath = false, bool includeIsCurrent = false) { return new ThemeResponseDto( Id: id ?? Guid.NewGuid(), ThemeId: themeId ?? _faker.Lorem.Word(), Name: name ?? _faker.Commerce.ProductName(), Description: description ?? _faker.Lorem.Sentence(), Author: author ?? _faker.Name.FullName(), Version: version ?? _faker.System.Semver(), PreviewPath: includePreviewPath ? (previewPath ?? (_faker.Random.Bool() ? _faker.System.FilePath() : null)) : null, InstallSource: installSource ?? ThemeInstallSource.Uploaded, IsCurrent: includeIsCurrent ? (isCurrent ?? (_faker.Random.Bool() ? true : null)) : null, InstalledAtUtc: installedAtUtc ?? _faker.Date.Recent(), IsDeleted: isDeleted ?? _faker.Random.Bool() ); } /// /// 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())]; } }