// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschraenkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System.Collections.Generic; using System.Linq; using FakeItEasy; using Squidex.Infrastructure.Queries; namespace Squidex.Domain.Apps.Entities.TestHelpers { public static class AExtensions { public static ClrQuery Is(this INegatableArgumentConstraintManager that, string query) { return that.Matches(x => x.ToString() == query); } public static T[] Is(this INegatableArgumentConstraintManager that, params T[]? values) { return values == null ? that.IsNull() : that.IsSameSequenceAs(values); } public static IEnumerable Has(this INegatableArgumentConstraintManager> that, params T[]? values) { return values == null ? that.IsNull() : that.Matches(x => x.Intersect(values).Count() == values.Length); } public static HashSet Has(this INegatableArgumentConstraintManager> that, params T[]? values) { return values == null ? that.IsNull() : that.Matches(x => x.Intersect(values).Count() == values.Length); } } }