Repository: microsoft/semantic-kernel
File: dotnet/test/VectorData/VectorData.ConformanceTests/TypeTests/KeyTypeTests.cs (C#)

Code before:
            Key = keyValue,
            Int = 8,
            Vector = new ReadOnlyMemory<float>([1, 2, 3])
        };

        var nextRecord = new Record<TKey>
        {
            Key = differentKey,
            Int = 9,
            Vector = new ReadOnlyMemory<float>([3, 2, 1])
        };

        await collection.UpsertAsync(record);
        await collection.UpsertAsync([record, nextRecord]);
        await fixture.TestStore.WaitForDataAsync(collection, recordCount: 2);

        var result = await collection.GetAsync(keyValue);

        Assert.NotNull(result);
        Assert.Equal(keyValue, result.Key);
        Assert.Equal(8, result.Int);

        var results = await collection.GetAsync([keyValue, differentKey]).ToListAsync();

        Assert.Equal(2, results.Count);
        Assert.Equal(keyValue, results[0].Key);
        Assert.Equal(8, results[0].Int);
        Assert.Equal(differentKey, results[1].Key);
        Assert.Equal(9, results[1].Int);

        ///////////////////////
        // Test dynamic mapping
        ///////////////////////
        await collection.DeleteAsync(keyValue);
        await collection.DeleteAsync([keyValue, differentKey]);
        await fixture.TestStore.WaitForDataAsync(collection, recordCount: 0);

        using var dynamicCollection = fixture.CreateDynamicCollection<TKey>();
        await dynamicCollection.EnsureCollectionExistsAsync();

        var dynamicRecord = new Dictionary<string, object?>
        {
            [nameof(Record<TKey>.Key)] = keyValue,
            [nameof(Record<TKey>.Int)] = 8,
            [nameof(Record<TKey>.Vector)] = new ReadOnlyMemory<float>([1, 2, 3])
        };
        var nextDynamicRecord = new Dictionary<string, object?>
        {
            [nameof(Record<TKey>.Key)] = differentKey,
            [nameof(Record<TKey>.Int)] = 9,
            [nameof(Record<TKey>.Vector)] = new ReadOnlyMemory<float>([3, 2, 1])

Review comment (bug):
This relies on the database returning records in the same ordering as the keys passed to GetAsync above - that's not currently guaranteed (e.g. SQL Server fails this because there's no ORDER BY in the SQL).

Opened #13358 to think about this, in the meantime I'll push a commit here which makes the test not depend on results ordering.

Code after:
        var record = new Record<TKey>
        {
            Key = key1,
            Int = 8,
            Vector = new ReadOnlyMemory<float>([1, 2, 3])
        };

        var nextRecord = new Record<TKey>
        {
            Key = key2,
            Int = 9,
            Vector = new ReadOnlyMemory<float>([3, 2, 1])
        };

        await collection.UpsertAsync(record);
        await collection.UpsertAsync([record, nextRecord]);
        await fixture.TestStore.WaitForDataAsync(collection, recordCount: 2);

        var result = await collection.GetAsync(key1);

        Assert.NotNull(result);
        Assert.Equal(key1, result.Key);
        Assert.Equal(8, result.Int);

        var results = await collection.GetAsync([key1, key2]).ToListAsync();
        Assert.Equal(2, results.Count);
        var firstRecord = Assert.Single(results, r => r.Key.Equals(key1));
        Assert.Equal(8, firstRecord.Int);
        var secondRecord = Assert.Single(results, r => r.Key.Equals(key2));
        Assert.Equal(9, secondRecord.Int);

        ///////////////////////
        // Test dynamic mapping
        ///////////////////////
        await collection.DeleteAsync(key1);
        await collection.DeleteAsync([key1, key2]);
        await fixture.TestStore.WaitForDataAsync(collection, recordCount: 0);

        using var dynamicCollection = fixture.CreateDynamicCollection<TKey>();
        await dynamicCollection.EnsureCollectionExistsAsync();

        var dynamicRecord = new Dictionary<string, object?>
        {
            [nameof(Record<TKey>.Key)] = key1,
            [nameof(Record<TKey>.Int)] = 8,
            [nameof(Record<TKey>.Vector)] = new ReadOnlyMemory<float>([1, 2, 3])
        };
        var nextDynamicRecord = new Dictionary<string, object?>
        {
            [nameof(Record<TKey>.Key)] = key2,
            [nameof(Record<TKey>.Int)] = 9,