mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 18:21:10 +00:00
Centralizes and standardizes test fixtures.
This commit is contained in:
1 parent
dfc513da4f
commit
b648e2f054
294 files changed
+3807
-4437
No files matched your search
@@ -0,0 +1,27 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using AutoFixture.Kernel;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.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();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user