mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 15:11:10 +00:00
Adds test fixtures and endpoint test coverage
This commit is contained in:
1 parent
c82fadc7a2
commit
7aeed04255
198 files changed
+11649
No files matched your search
+46
@@ -0,0 +1,46 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Common.Infrastructure.Models.DTO.Themes;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Common.Infrastructure.Models.DTO.Themes;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="ThemeArchiveDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ThemeArchiveDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="ThemeArchiveDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="bytes">Optional. The bytes of the ZIP archive.</param>
|
||||
/// <param name="fileName">Optional. The file name to expose when downloading the archive.</param>
|
||||
/// <param name="contentType">Optional. The MIME content type of the archive.</param>
|
||||
/// <returns>The created <see cref="ThemeArchiveDto"/>.</returns>
|
||||
public ThemeArchiveDto Create(
|
||||
byte[]? bytes = null,
|
||||
string? fileName = null,
|
||||
string? contentType = null)
|
||||
{
|
||||
return new ThemeArchiveDto(
|
||||
bytes ?? _faker.Random.Bytes(10),
|
||||
fileName ?? _faker.System.FileName(),
|
||||
contentType ?? _faker.System.MimeType());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="ThemeArchiveDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<ThemeArchiveDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Common.Infrastructure.Models.DTO.Themes;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Common.Infrastructure.Models.DTO.Themes;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="ThemeAssetDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ThemeAssetDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="ThemeAssetDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="bytes">Optional. The bytes of the asset file.</param>
|
||||
/// <param name="contentType">Optional. The MIME content type of the asset file.</param>
|
||||
/// <returns>The created <see cref="ThemeAssetDto"/>.</returns>
|
||||
public ThemeAssetDto Create(
|
||||
byte[]? bytes = null,
|
||||
string? contentType = null)
|
||||
{
|
||||
return new ThemeAssetDto(
|
||||
bytes ?? _faker.Random.Bytes(10),
|
||||
contentType ?? _faker.System.MimeType());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="ThemeAssetDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<ThemeAssetDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user