Repository: dotnet/efcore
File: test/EFCore.Sqlite.FunctionalTests/BuiltInDataTypesSqliteTest.cs (C#)

Code before:
        {
            Id = 3,
            TestDecimal = 2.5m
        };
        context.Add(max);

        context.SaveChanges();

        var query = context.Set<BuiltInDataTypes>();

        var results = query
            .OrderBy(e => e.TestDecimal)
            .Select(e => new { e.Id, e.TestDecimal })
            .ToList();

        var expectedResults = query.AsEnumerable()
            .OrderBy(e => e.TestDecimal)
            .Select(e => new { e.Id, e.TestDecimal })
            .ToList();

        Assert.Equal(expectedResults.Count, results.Count);
        for (var i = 0; i < expectedResults.Count; i++)
        {
            Assert.Equal(expectedResults[i].Id, results[i].Id);
            Assert.Equal(expectedResults[i].TestDecimal, results[i].TestDecimal);
        }
    }

    [ConditionalFact]
    public virtual void Can_query_using_char_ToLower()
    {
        using var context = CreateContext();

        var results = context.Set<ObjectBackedDataTypes>()
            .Select(e => char.ToLower(e.Character)).ToList();

        AssertSql(
            """
SELECT lower("o"."Character")
FROM "ObjectBackedDataTypes" AS "o"
""");

        var expectedResults = context.Set<ObjectBackedDataTypes>().AsEnumerable()
            .Select(e => char.ToLower(e.Character)).ToList();

        Assert.Equal(expectedResults, results);
    }

    [ConditionalFact]
    public virtual void Can_query_using_char_ToUpper()
    {

Review comment (bug):
The test uses a loop with individual assertions for each element. Consider using `Assert.Equal(expectedResults, results)` directly, as xUnit can compare collections of anonymous types by value. This is more concise and provides better failure messages if the test fails. This pattern is consistent with similar tests in the file that use `Assert.Equal()` for comparing collections.
```suggestion
        Assert.Equal(expectedResults, results);
```

Code after:
        {
            Id = 229,
            TestDecimal = 2.5m
        };
        context.Add(max);

        context.SaveChanges();
        Fixture.TestSqlLoggerFactory.Clear();

        var query = context.Set<BuiltInDataTypes>();

        var results = query
            .OrderBy(e => e.TestDecimal)
            .Select(e => new { e.Id, e.TestDecimal })
            .ToList();

        var expectedResults = query.AsEnumerable()
            .OrderBy(e => e.TestDecimal)
            .Select(e => new { e.Id, e.TestDecimal })
            .ToList();

        Assert.Equal(expectedResults, results);

        AssertSql(
            """
SELECT "b"."Id", "b"."TestDecimal"
FROM "BuiltInDataTypes" AS "b"
ORDER BY "b"."TestDecimal" COLLATE EF_DECIMAL
""",
                //
                """
SELECT "b"."Id", "b"."Enum16", "b"."Enum32", "b"."Enum64", "b"."Enum8", "b"."EnumS8", "b"."EnumU16", "b"."EnumU32", "b"."EnumU64", "b"."PartitionId", "b"."TestBoolean", "b"."TestByte", "b"."TestCharacter", "b"."TestDateOnly", "b"."TestDateTime", "b"."TestDateTimeOffset", "b"."TestDecimal", "b"."TestDouble", "b"."TestInt16", "b"."TestInt32", "b"."TestInt64", "b"."TestSignedByte", "b"."TestSingle", "b"."TestTimeOnly", "b"."TestTimeSpan", "b"."TestUnsignedInt16", "b"."TestUnsignedInt32", "b"."TestUnsignedInt64"
FROM "BuiltInDataTypes" AS "b"
""");
    }

    [ConditionalFact]
    public virtual void Can_query_using_char_ToLower()
    {
        using var context = CreateContext();

        var results = context.Set<ObjectBackedDataTypes>()
            .Select(e => char.ToLower(e.Character)).ToList();

        AssertSql(
            """
SELECT lower("o"."Character")
FROM "ObjectBackedDataTypes" AS "o"
""");

        var expectedResults = context.Set<ObjectBackedDataTypes>().AsEnumerable()