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

Code before:
        };
        context.Add(min);

        var middle = new BuiltInDataTypes
        {
            Id = 2,
            TestDecimal = 1.5m
        };
        context.Add(middle);

        var max = new BuiltInDataTypes
        {
            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"

Review comment (suggestion):
The test should include an `AssertSql()` call after executing the query to verify that the correct SQL is generated with the `COLLATE EF_DECIMAL` clause. This is consistent with the pattern in other decimal ordering tests in this file, such as `Can_query_OrderBy_of_converted_types()` and `Can_query_ThenBy_of_converted_types()`.

Code after:
        };
        context.Add(min);

        var middle = new BuiltInDataTypes
        {
            Id = 228,
            TestDecimal = 1.5m
        };
        context.Add(middle);

        var max = new BuiltInDataTypes
        {
            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();