You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/src/Recyclarr.Common/FluentValidation/CustomValidator.cs

21 lines
444 B

using FluentValidation;
using Recyclarr.Common.Extensions;
namespace Recyclarr.Common.FluentValidation;
public abstract class CustomValidator<T> : AbstractValidator<T>
{
public bool OnlyOneHasElements<TC1, TC2>(
IEnumerable<TC1>? c1,
IEnumerable<TC2>? c2)
{
var notEmpty = new[]
{
c1.IsNotEmpty(),
c2.IsNotEmpty()
};
return notEmpty.Count(x => x) <= 1;
}
}