mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 15:11:10 +00:00
Implements tests for commit dfd979ec1e
This commit is contained in:
1 parent
d8adf3c1b6
commit
968061e89a
111 files changed
+19955
-292
No files matched your search
+8
-1
@@ -27,6 +27,13 @@ public static class GetMostConsumedRequestMapping
|
||||
PerPage = request.PerPage ?? 50
|
||||
};
|
||||
|
||||
return new GetMostConsumedQuery(targetUserId, request.LibraryId, request.MediaKind, request.FromUtc, request.ToUtc, paginationData);
|
||||
return new GetMostConsumedQuery(
|
||||
targetUserId,
|
||||
request.LibraryId,
|
||||
request.MediaKind,
|
||||
request.FromUtc,
|
||||
request.ToUtc,
|
||||
paginationData
|
||||
);
|
||||
}
|
||||
}
|
||||
+8
-1
@@ -27,6 +27,13 @@ public static class GetRecentlyConsumedRequestMapping
|
||||
PerPage = request.PerPage ?? 50
|
||||
};
|
||||
|
||||
return new GetRecentlyConsumedQuery(targetUserId, request.LibraryId, request.MediaKind, request.FromUtc, request.ToUtc, paginationData);
|
||||
return new GetRecentlyConsumedQuery(
|
||||
targetUserId,
|
||||
request.LibraryId,
|
||||
request.MediaKind,
|
||||
request.FromUtc,
|
||||
request.ToUtc,
|
||||
paginationData
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using Lumina.Application.Common.Infrastructure.Validation;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
#endregion
|
||||
|
||||
@@ -258,6 +259,23 @@ public static class ValidatorUtilities
|
||||
return ruleBuilder.Must(value => value.HasValue && Enum.IsDefined(value.Value));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines a validation rule that ensures a textual enum value is either <see langword="null"/> or the name of a defined member of the specified
|
||||
/// enumeration type.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Only the member names of the enumeration are accepted, so a numeric value is rejected even when it is a defined member. A
|
||||
/// <see langword="null"/> value represents an omitted optional filter and passes.
|
||||
/// </remarks>
|
||||
/// <typeparam name="TRequest">The type of the request being validated.</typeparam>
|
||||
/// <typeparam name="TEnum">The type of the enumeration.</typeparam>
|
||||
/// <param name="ruleBuilder">The rule builder instance.</param>
|
||||
/// <returns>The current <see cref="IRuleBuilder{TRequest, TProperty}"/> instance for method chaining.</returns>
|
||||
public static IRuleBuilder<TRequest, string?> IsInEnum<TRequest, TEnum>(this IRuleBuilder<TRequest, string?> ruleBuilder) where TEnum : struct, Enum
|
||||
{
|
||||
return ruleBuilder.Must(value => value is null || Enum.GetNames<TEnum>().Contains(value, StringComparer.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines a validation rule that ensures the string property does not exceed the specified maximum length.
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user