Centralizes and standardizes test fixtures.

This commit is contained in:
BinaryAlley committed 2026-08-15 02:58:17 -07:00
1 parent dfc513da4f
commit b648e2f054
294 files changed
+3807 -4437

No files matched your search

@@ -1,38 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.DataAccess.UnitTests.Common.Setup;
/// <summary>
/// Contains extension methods for the <see cref="Faker"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public static class BogusExtensions
{
/// <summary>
/// Adds <see cref="DateOnly"/> random data generation support to the <see cref="Faker"/> class.
/// </summary>
/// <param name="faker">The faker instance to extend.</param>
/// <returns>A random<see cref="DateOnly"/> instance.</returns>
public static DateOnly DateOnly(this Faker faker)
{
return System.DateOnly.FromDateTime(faker.Date.Past());
}
/// <summary>
/// Adds <see cref="DateOnly"/> random data generation within a specified interval support to the <see cref="Faker"/> class.
/// </summary>
/// <param name="faker">The faker instance to extend.</param>
/// <param name="start">The start of the interval.</param>
/// <param name="end">The end of the interval.</param>
/// <returns>A random<see cref="DateOnly"/> instance.</returns>
public static DateOnly DateOnlyBetween(this Faker faker, DateOnly start, DateOnly end)
{
DateTime startDateTime = start.ToDateTime(TimeOnly.MinValue);
DateTime endDateTime = end.ToDateTime(TimeOnly.MinValue);
return System.DateOnly.FromDateTime(faker.Date.Between(startDateTime, endDateTime));
}
}
@@ -1,27 +0,0 @@
#region ========================================================================= USING =====================================================================================
using AutoFixture.Kernel;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.DataAccess.UnitTests.Common.Setup;
/// <summary>
/// Represents a specimen builder for the <see cref="DateOnly"/> type.
/// </summary>
[ExcludeFromCodeCoverage]
public class DateOnlySpecimenBuilder : ISpecimenBuilder
{
/// <summary>
/// Adds <see cref="DateOnly"/> support to the AutoFixture library.
/// </summary>
/// <param name="request">The request to process.</param>
/// <param name="context">The context within which the specimen is created.</param>
/// <returns>A specimen based on the request.</returns>
public object Create(object request, ISpecimenContext context)
{
if (request is Type type && type == typeof(DateOnly))
return DateOnly.FromDateTime(DateTime.Now);
return new NoSpecimen();
}
}
@@ -1,27 +0,0 @@
#region ========================================================================= USING =====================================================================================
using AutoFixture.Kernel;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.DataAccess.UnitTests.Common.Setup;
/// <summary>
/// Represents a specimen builder for the <see cref="DateOnly"/> type.
/// </summary>
[ExcludeFromCodeCoverage]
public class NullableDateOnlySpecimenBuilder : ISpecimenBuilder
{
/// <summary>
/// Adds <see cref="DateOnly?"/> support to the AutoFixture library.
/// </summary>
/// <param name="request">The request to process.</param>
/// <param name="context">The context within which the specimen is created.</param>
/// <returns>A specimen based on the request.</returns>
public object Create(object request, ISpecimenContext context)
{
if (request is Type type && type == typeof(DateOnly?))
return (DateOnly?)DateOnly.FromDateTime(DateTime.Now);
return new NoSpecimen();
}
}