Repository: dotnet/efcore
File: test/EFCore.Specification.Tests/Query/AdHocQueryFiltersQueryTestBase.cs (C#)

Code before:
        var result = context.Entities
            .IgnoreQueryFilters(["ActiveFilter", "NameFilter"])
            .ToList();
        Assert.Equal(2, result.Count);
    }

    [ConditionalFact]
    public virtual async Task Named_query_filters_caching()
    {
        var cacheLog = new List<string>();
        var contextFactory = await InitializeAsync<Context8576_NamedFilters>(seed: c => c.SeedAsync(), onConfiguring: builder =>
        {
            builder.EnableSensitiveDataLogging();
            builder.LogTo(cacheLog.Add, filter: (eventid, _) => eventid.Name == CoreEventId.QueryCompilationStarting.Name);
        });
        using var context = contextFactory.CreateContext();
        _ = context.Entities
            .IgnoreQueryFilters(["ActiveFilter", "NameFilter"])
            .ToList();
        _ = context.Entities
            .IgnoreQueryFilters(["ActiveFilter", "NameFilter"])
            .ToList();
        _ = context.Entities
            .IgnoreQueryFilters(["NameFilter", "ActiveFilter"])
            .ToList();
        Assert.Equal(1, cacheLog.Count);
    }

    [ConditionalFact]
    public virtual async Task Named_query_filters_ignore_all()
    {
        var contextFactory = await InitializeAsync<Context8576_NamedFilters>(seed: c => c.SeedAsync());
        using var context = contextFactory.CreateContext();

        var result = context.Entities
            .IgnoreQueryFilters()
            .ToList();
        Assert.Equal(2, result.Count);
    }

    [ConditionalFact]
    public virtual async Task Named_query_filters_anonymous()
    {
        var contextFactory = await InitializeAsync<Context8576>(seed: c => c.SeedAsync());
        using var context = contextFactory.CreateContext();

        var result = context.Entities
            .ToList();
        Assert.Single(result);
    }


Review comment (suggestion):
This will be `2` then. And we can consider it expected. You can add comment and mention #37212.

Code after:
        var result = context.Entities
            .IgnoreQueryFilters(["ActiveFilter", "NameFilter"])
            .ToList();
        Assert.Equal(2, result.Count);
    }

    [ConditionalFact]
    public virtual async Task Named_query_filters_caching()
    {
        var cacheLog = new List<string>();
        var contextFactory = await InitializeAsync<Context8576_NamedFilters>(seed: c => c.SeedAsync(), onConfiguring: builder =>
        {
            builder.EnableSensitiveDataLogging();
            builder.LogTo(cacheLog.Add, filter: (eventid, _) => eventid.Name == CoreEventId.QueryCompilationStarting.Name);
        });
        using var context = contextFactory.CreateContext();
        _ = context.Entities
            .IgnoreQueryFilters(["ActiveFilter", "NameFilter"])
            .ToList();
        _ = context.Entities
            .IgnoreQueryFilters(["ActiveFilter", "NameFilter"])
            .ToList();
        _ = context.Entities
            .IgnoreQueryFilters(["NameFilter", "ActiveFilter"])
            .ToList();

        // #37212 - ExpressionEqualityComparer doesn't support collections besides an array,
        // therefore we can't implement caching for different order of ignored filters
        Assert.Equal(2, cacheLog.Count);
    }

    [ConditionalFact]
    public virtual async Task Named_query_filters_ignore_all()
    {
        var contextFactory = await InitializeAsync<Context8576_NamedFilters>(seed: c => c.SeedAsync());
        using var context = contextFactory.CreateContext();

        var result = context.Entities
            .IgnoreQueryFilters()
            .ToList();
        Assert.Equal(2, result.Count);
    }

    [ConditionalFact]
    public virtual async Task Named_query_filters_anonymous()
    {
        var contextFactory = await InitializeAsync<Context8576>(seed: c => c.SeedAsync());
        using var context = contextFactory.CreateContext();

        var result = context.Entities
            .ToList();