diff --git a/dotnet/src/InternalUtilities/connectors/Memory/MongoDB/MongoModelBuilder.cs b/dotnet/src/InternalUtilities/connectors/Memory/MongoDB/MongoModelBuilder.cs index 43ca3cfdb1d8..bb6d9e2daa2d 100644 --- a/dotnet/src/InternalUtilities/connectors/Memory/MongoDB/MongoModelBuilder.cs +++ b/dotnet/src/InternalUtilities/connectors/Memory/MongoDB/MongoModelBuilder.cs @@ -44,9 +44,9 @@ protected override void ProcessTypeProperties(Type type, VectorStoreCollectionDe protected override bool IsKeyPropertyTypeValid(Type type, [NotNullWhen(false)] out string? supportedTypes) { - supportedTypes = "string, Guid, ObjectId"; + supportedTypes = "string, int, long, Guid, ObjectId"; - return type == typeof(string) || type == typeof(Guid) || type == typeof(ObjectId); + return type == typeof(string) || type == typeof(int) || type == typeof(long) || type == typeof(Guid) || type == typeof(ObjectId); } protected override bool IsDataPropertyTypeValid(Type type, [NotNullWhen(false)] out string? supportedTypes) diff --git a/dotnet/src/VectorData/AzureAISearch/AzureAISearchCollection.cs b/dotnet/src/VectorData/AzureAISearch/AzureAISearchCollection.cs index 9792adfdfffc..e80368556336 100644 --- a/dotnet/src/VectorData/AzureAISearch/AzureAISearchCollection.cs +++ b/dotnet/src/VectorData/AzureAISearch/AzureAISearchCollection.cs @@ -83,9 +83,9 @@ internal AzureAISearchCollection(SearchIndexClient searchIndexClient, string nam Verify.NotNull(searchIndexClient); Verify.NotNullOrWhiteSpace(name); - if (typeof(TKey) != typeof(string) && typeof(TKey) != typeof(object)) + if (typeof(TKey) != typeof(string) && typeof(TKey) != typeof(Guid) && typeof(TKey) != typeof(object)) { - throw new NotSupportedException("Only string keys are supported."); + throw new NotSupportedException("Only string and Guid keys are supported."); } options ??= AzureAISearchCollectionOptions.Default; @@ -791,7 +791,13 @@ private string GetStringKey(TKey key) { Verify.NotNull(key); - var stringKey = key as string ?? throw new UnreachableException("string key should have been validated during model building"); + var stringKey = key switch + { + string s => s, + Guid g => g.ToString(), + + _ => throw new UnreachableException("string key should have been validated during model building") + }; Verify.NotNullOrWhiteSpace(stringKey, nameof(key)); diff --git a/dotnet/src/VectorData/AzureAISearch/AzureAISearchModelBuilder.cs b/dotnet/src/VectorData/AzureAISearch/AzureAISearchModelBuilder.cs index f5101e741ec2..b281a79cbfc6 100644 --- a/dotnet/src/VectorData/AzureAISearch/AzureAISearchModelBuilder.cs +++ b/dotnet/src/VectorData/AzureAISearch/AzureAISearchModelBuilder.cs @@ -31,9 +31,9 @@ protected override bool IsVectorPropertyTypeValid(Type type, [NotNullWhen(false) internal static bool IsKeyPropertyTypeValidCore(Type type, [NotNullWhen(false)] out string? supportedTypes) { - supportedTypes = "string"; + supportedTypes = "string, Guid"; - return type == typeof(string); + return type == typeof(string) || type == typeof(Guid); } internal static bool IsDataPropertyTypeValidCore(Type type, [NotNullWhen(false)] out string? supportedTypes) diff --git a/dotnet/src/VectorData/CosmosMongoDB/CosmosMongoCollection.cs b/dotnet/src/VectorData/CosmosMongoDB/CosmosMongoCollection.cs index 02883f452c5c..16dba308f78f 100644 --- a/dotnet/src/VectorData/CosmosMongoDB/CosmosMongoCollection.cs +++ b/dotnet/src/VectorData/CosmosMongoDB/CosmosMongoCollection.cs @@ -67,6 +67,8 @@ public class CosmosMongoCollection : VectorStoreCollectionThe size of the dynamic candidate list for search. private readonly int _efSearch; + private static readonly Type[] s_validKeyTypes = [typeof(string), typeof(Guid), typeof(ObjectId), typeof(int), typeof(long)]; + /// /// Initializes a new instance of the class. /// @@ -95,9 +97,9 @@ internal CosmosMongoCollection(IMongoDatabase mongoDatabase, string name, Func GetCompositeKeys(IEnumerable => keys switch { IEnumerable k => k, + IEnumerable k => k.Select(key => new CosmosNoSqlCompositeKey(recordKey: key, partitionKey: key)), + + IEnumerable k => k.Select(key => + { + var guidString = key.ToString(); + return new CosmosNoSqlCompositeKey(recordKey: guidString, partitionKey: guidString); + }), + IEnumerable k => k.Select(key => key switch { string s => new CosmosNoSqlCompositeKey(recordKey: s, partitionKey: s), CosmosNoSqlCompositeKey ck => ck, _ => throw new ArgumentException($"Invalid key type '{key.GetType().Name}'.") }), + _ => throw new UnreachableException() }; diff --git a/dotnet/src/VectorData/CosmosNoSql/CosmosNoSqlModelBuilder.cs b/dotnet/src/VectorData/CosmosNoSql/CosmosNoSqlModelBuilder.cs index 74781065891b..6690a0ca150c 100644 --- a/dotnet/src/VectorData/CosmosNoSql/CosmosNoSqlModelBuilder.cs +++ b/dotnet/src/VectorData/CosmosNoSql/CosmosNoSqlModelBuilder.cs @@ -23,10 +23,9 @@ internal class CosmosNoSqlModelBuilder() : CollectionJsonModelBuilder(s_modelBui protected override bool IsKeyPropertyTypeValid(Type type, [NotNullWhen(false)] out string? supportedTypes) { - // TODO: Cosmos supports other key types (int, Guid...) - supportedTypes = "string"; + supportedTypes = "string, Guid"; - return type == typeof(string); + return type == typeof(string) || type == typeof(Guid); } protected override bool IsDataPropertyTypeValid(Type type, [NotNullWhen(false)] out string? supportedTypes) diff --git a/dotnet/src/VectorData/MongoDB/MongoCollection.cs b/dotnet/src/VectorData/MongoDB/MongoCollection.cs index bb9716ecbba5..565667bda0e3 100644 --- a/dotnet/src/VectorData/MongoDB/MongoCollection.cs +++ b/dotnet/src/VectorData/MongoDB/MongoCollection.cs @@ -76,7 +76,7 @@ public class MongoCollection : VectorStoreCollectionTypes of keys permitted. - private readonly Type[] _validKeyTypes = [typeof(string), typeof(Guid), typeof(ObjectId)]; + private static readonly Type[] s_validKeyTypes = [typeof(string), typeof(Guid), typeof(ObjectId), typeof(int), typeof(long)]; /// /// Initializes a new instance of the class. @@ -106,9 +106,9 @@ internal MongoCollection(IMongoDatabase mongoDatabase, string name, Func s, + Guid g => g.ToString(), + + _ => throw new UnreachableException() + }; Verify.NotNullOrWhiteSpace(stringKey, nameof(key)); diff --git a/dotnet/src/VectorData/Pinecone/PineconeFilterTranslator.cs b/dotnet/src/VectorData/Pinecone/PineconeFilterTranslator.cs index bfe02e9b013a..33516d2c5418 100644 --- a/dotnet/src/VectorData/Pinecone/PineconeFilterTranslator.cs +++ b/dotnet/src/VectorData/Pinecone/PineconeFilterTranslator.cs @@ -23,13 +23,21 @@ internal class PineconeFilterTranslator private Extensions.VectorData.ProviderServices.CollectionModel _model = null!; private ParameterExpression _recordParameter = null!; - internal Metadata Translate(LambdaExpression lambdaExpression, Extensions.VectorData.ProviderServices.CollectionModel model) + internal Metadata? Translate(LambdaExpression lambdaExpression, Extensions.VectorData.ProviderServices.CollectionModel model) { this._model = model; Debug.Assert(lambdaExpression.Parameters.Count == 1); this._recordParameter = lambdaExpression.Parameters[0]; + // Pinecone doesn't seem to have a native way of expressing "always true" filters; since this scenario is important for fetching + // all records (via GetAsync with filter), we special-case and support it here. Note that false isn't supported (useless), + // nor is 'x && true'. + if (lambdaExpression.Body is ConstantExpression { Value: true }) + { + return null; + } + var preprocessor = new FilterTranslationPreprocessor { SupportsParameterization = false }; var preprocessedExpression = preprocessor.Preprocess(lambdaExpression.Body); diff --git a/dotnet/src/VectorData/Pinecone/PineconeMapper.cs b/dotnet/src/VectorData/Pinecone/PineconeMapper.cs index 3e0ce4b78ab9..5c43ab1b7191 100644 --- a/dotnet/src/VectorData/Pinecone/PineconeMapper.cs +++ b/dotnet/src/VectorData/Pinecone/PineconeMapper.cs @@ -44,7 +44,12 @@ public Vector MapFromDataToStorageModel(TRecord dataModel, Embedding? gen // TODO: what about sparse values? var result = new Vector { - Id = (string)keyObject, + Id = keyObject switch + { + string s => s, + Guid g => g.ToString(), + _ => throw new UnreachableException() + }, Values = values, Metadata = metadata, SparseValues = null @@ -58,7 +63,13 @@ public TRecord MapFromStorageToDataModel(Vector storageModel, bool includeVector { var outputRecord = model.CreateRecord()!; - model.KeyProperty.SetValueAsObject(outputRecord, storageModel.Id); + model.KeyProperty.SetValueAsObject(outputRecord, model.KeyProperty.Type switch + { + var t when t == typeof(string) => storageModel.Id, + var t when t == typeof(Guid) => Guid.Parse(storageModel.Id), + + _ => throw new UnreachableException() + }); if (includeVectors is true) { diff --git a/dotnet/src/VectorData/Pinecone/PineconeModelBuilder.cs b/dotnet/src/VectorData/Pinecone/PineconeModelBuilder.cs index 60e8bbb1de1d..cdba6c103e92 100644 --- a/dotnet/src/VectorData/Pinecone/PineconeModelBuilder.cs +++ b/dotnet/src/VectorData/Pinecone/PineconeModelBuilder.cs @@ -21,9 +21,9 @@ internal class PineconeModelBuilder() : CollectionModelBuilder(s_validationOptio protected override bool IsKeyPropertyTypeValid(Type type, [NotNullWhen(false)] out string? supportedTypes) { - supportedTypes = "string"; + supportedTypes = "string, Guid"; - return type == typeof(string); + return type == typeof(string) || type == typeof(Guid); } protected override bool IsDataPropertyTypeValid(Type type, [NotNullWhen(false)] out string? supportedTypes) diff --git a/dotnet/src/VectorData/Redis/RedisHashSetCollection.cs b/dotnet/src/VectorData/Redis/RedisHashSetCollection.cs index 672bfba900b4..34dd631df5f8 100644 --- a/dotnet/src/VectorData/Redis/RedisHashSetCollection.cs +++ b/dotnet/src/VectorData/Redis/RedisHashSetCollection.cs @@ -88,9 +88,9 @@ internal RedisHashSetCollection(IDatabase database, string name, Func s, + Guid g => g.ToString(), + + _ => throw new UnreachableException("string key should have been validated during model building") + }; Verify.NotNullOrWhiteSpace(stringKey, nameof(key)); diff --git a/dotnet/src/VectorData/Redis/RedisHashSetMapper.cs b/dotnet/src/VectorData/Redis/RedisHashSetMapper.cs index 90b9fa3d7be9..b19b9e9ad96a 100644 --- a/dotnet/src/VectorData/Redis/RedisHashSetMapper.cs +++ b/dotnet/src/VectorData/Redis/RedisHashSetMapper.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Runtime.InteropServices; using Microsoft.Extensions.AI; @@ -19,8 +20,13 @@ internal sealed class RedisHashSetMapper(CollectionModel mod /// public (string Key, HashEntry[] HashEntries) MapFromDataToStorageModel(TConsumerDataModel dataModel, int recordIndex, IReadOnlyList?[]? generatedEmbeddings) { - var keyValue = model.KeyProperty.GetValueAsObject(dataModel!) as string ?? - throw new InvalidOperationException($"Missing key property {model.KeyProperty.ModelName} on provided record of type '{typeof(TConsumerDataModel).Name}'."); + var keyValue = model.KeyProperty.GetValueAsObject(dataModel!) switch + { + string s => s, + Guid g => g.ToString(), + + _ => throw new InvalidOperationException($"Missing key property {model.KeyProperty.ModelName} on provided record of type '{typeof(TConsumerDataModel).Name}'.") + }; var hashEntries = new List(); foreach (var property in model.DataProperties) @@ -67,7 +73,15 @@ public TConsumerDataModel MapFromStorageToDataModel((string Key, HashEntry[] Has var outputRecord = model.CreateRecord()!; // Set Key. - model.KeyProperty.SetValueAsObject(outputRecord, storageModel.Key); + model.KeyProperty.SetValueAsObject(outputRecord, model.KeyProperty.Type switch + { + Type t when t == typeof(string) + => storageModel.Key, + Type t when t == typeof(Guid) + => Guid.Parse(storageModel.Key), + + _ => throw new UnreachableException() + }); // Set each vector property if embeddings should be returned. if (includeVectors) diff --git a/dotnet/src/VectorData/Redis/RedisJsonCollection.cs b/dotnet/src/VectorData/Redis/RedisJsonCollection.cs index 6db5dbf92e9e..625ffe64ad33 100644 --- a/dotnet/src/VectorData/Redis/RedisJsonCollection.cs +++ b/dotnet/src/VectorData/Redis/RedisJsonCollection.cs @@ -97,9 +97,9 @@ internal RedisJsonCollection(IDatabase database, string name, Func); @@ -596,7 +596,13 @@ private string GetStringKey(TKey key) { Verify.NotNull(key); - var stringKey = key as string ?? throw new UnreachableException("string key should have been validated during model building"); + var stringKey = key switch + { + string s => s, + Guid g => g.ToString(), + + _ => throw new UnreachableException("string key should have been validated during model building") + }; Verify.NotNullOrWhiteSpace(stringKey, nameof(key)); diff --git a/dotnet/src/VectorData/Redis/RedisJsonModelBuilder.cs b/dotnet/src/VectorData/Redis/RedisJsonModelBuilder.cs index 82115b0f6f60..2e831563fe85 100644 --- a/dotnet/src/VectorData/Redis/RedisJsonModelBuilder.cs +++ b/dotnet/src/VectorData/Redis/RedisJsonModelBuilder.cs @@ -19,9 +19,9 @@ internal class RedisJsonModelBuilder(CollectionModelBuildingOptions options) : C protected override bool IsKeyPropertyTypeValid(Type type, [NotNullWhen(false)] out string? supportedTypes) { - supportedTypes = "string"; + supportedTypes = "string, Guid"; - return type == typeof(string); + return type == typeof(string) || type == typeof(Guid); } protected override bool IsDataPropertyTypeValid(Type type, [NotNullWhen(false)] out string? supportedTypes) diff --git a/dotnet/src/VectorData/Redis/RedisModelBuilder.cs b/dotnet/src/VectorData/Redis/RedisModelBuilder.cs index c8ddf3c0c34c..5ae92c695ca7 100644 --- a/dotnet/src/VectorData/Redis/RedisModelBuilder.cs +++ b/dotnet/src/VectorData/Redis/RedisModelBuilder.cs @@ -21,9 +21,9 @@ internal class RedisModelBuilder(CollectionModelBuildingOptions options) : Colle protected override bool IsKeyPropertyTypeValid(Type type, [NotNullWhen(false)] out string? supportedTypes) { - supportedTypes = "string"; + supportedTypes = "string, Guid"; - return type == typeof(string); + return type == typeof(string) || type == typeof(Guid); } protected override bool IsDataPropertyTypeValid(Type type, [NotNullWhen(false)] out string? supportedTypes) diff --git a/dotnet/src/VectorData/SqlServer/SqlServerModelBuilder.cs b/dotnet/src/VectorData/SqlServer/SqlServerModelBuilder.cs index 688861f72928..70e444e88544 100644 --- a/dotnet/src/VectorData/SqlServer/SqlServerModelBuilder.cs +++ b/dotnet/src/VectorData/SqlServer/SqlServerModelBuilder.cs @@ -22,14 +22,12 @@ internal class SqlServerModelBuilder() : CollectionModelBuilder(s_modelBuildingO protected override bool IsKeyPropertyTypeValid(Type type, [NotNullWhen(false)] out string? supportedTypes) { - supportedTypes = "int, long, string, Guid, DateTime, or byte[]"; + supportedTypes = "int, long, string, Guid"; return type == typeof(int) // INT || type == typeof(long) // BIGINT || type == typeof(string) // VARCHAR - || type == typeof(Guid) // UNIQUEIDENTIFIER - || type == typeof(DateTime) // DATETIME2 - || type == typeof(byte[]); // VARBINARY + || type == typeof(Guid); // UNIQUEIDENTIFIER } protected override bool IsDataPropertyTypeValid(Type type, [NotNullWhen(false)] out string? supportedTypes) diff --git a/dotnet/src/VectorData/SqliteVec/SqliteCollection.cs b/dotnet/src/VectorData/SqliteVec/SqliteCollection.cs index 570865cc2acb..169ec78f8061 100644 --- a/dotnet/src/VectorData/SqliteVec/SqliteCollection.cs +++ b/dotnet/src/VectorData/SqliteVec/SqliteCollection.cs @@ -85,9 +85,13 @@ internal SqliteCollection(string connectionString, string name, Func Parameters => this._parameters; + protected override void TranslateConstant(object? value, bool isSearchCondition) + { + switch (value) + { + case Guid g: + // Microsoft.Data.Sqlite writes GUIDs as upper-case strings, align our constant formatting with that. + this._sql.Append('\'').Append(g.ToString().ToUpperInvariant()).Append('\''); + break; + default: + base.TranslateConstant(value, isSearchCondition); + break; + } + } + // TODO: support Contains over array fields (#10343) protected override void TranslateContainsOverArrayColumn(Expression source, Expression item) => throw new NotSupportedException("Unsupported Contains expression"); diff --git a/dotnet/src/VectorData/SqliteVec/SqliteMapper.cs b/dotnet/src/VectorData/SqliteVec/SqliteMapper.cs index b5aa0e2c6ed8..e06dacdf0179 100644 --- a/dotnet/src/VectorData/SqliteVec/SqliteMapper.cs +++ b/dotnet/src/VectorData/SqliteVec/SqliteMapper.cs @@ -96,6 +96,7 @@ public TRecord MapFromStorageToDataModel(DbDataReader reader, bool includeVector Type t when t == typeof(float) => reader.GetFloat(ordinal), Type t when t == typeof(double) => reader.GetDouble(ordinal), Type t when t == typeof(string) => reader.GetString(ordinal), + Type t when t == typeof(Guid) => reader.GetGuid(ordinal), Type t when t == typeof(byte[]) => (byte[])reader[ordinal], Type t when t == typeof(ReadOnlyMemory) => (byte[])reader[ordinal], Type t when t == typeof(Embedding) => (byte[])reader[ordinal], diff --git a/dotnet/src/VectorData/SqliteVec/SqliteModelBuilder.cs b/dotnet/src/VectorData/SqliteVec/SqliteModelBuilder.cs index ef74a1a2b7e1..d771bc016f9b 100644 --- a/dotnet/src/VectorData/SqliteVec/SqliteModelBuilder.cs +++ b/dotnet/src/VectorData/SqliteVec/SqliteModelBuilder.cs @@ -20,14 +20,14 @@ internal class SqliteModelBuilder() : CollectionModelBuilder(s_modelBuildingOpti protected override bool IsKeyPropertyTypeValid(Type type, [NotNullWhen(false)] out string? supportedTypes) { - supportedTypes = "int, long, string"; + supportedTypes = "int, long, string, Guid"; - return type == typeof(int) || type == typeof(long) || type == typeof(string); + return type == typeof(int) || type == typeof(long) || type == typeof(string) || type == typeof(Guid); } protected override bool IsDataPropertyTypeValid(Type type, [NotNullWhen(false)] out string? supportedTypes) { - supportedTypes = "int, long, short, string, bool, float, double, byte[]"; + supportedTypes = "int, long, short, string, bool, float, double, byte[], Guid"; if (Nullable.GetUnderlyingType(type) is Type underlyingType) { @@ -41,7 +41,8 @@ protected override bool IsDataPropertyTypeValid(Type type, [NotNullWhen(false)] || type == typeof(bool) || type == typeof(float) || type == typeof(double) - || type == typeof(byte[]); + || type == typeof(byte[]) + || type == typeof(Guid); } protected override bool IsVectorPropertyTypeValid(Type type, [NotNullWhen(false)] out string? supportedTypes) diff --git a/dotnet/src/VectorData/SqliteVec/SqlitePropertyMapping.cs b/dotnet/src/VectorData/SqliteVec/SqlitePropertyMapping.cs index ae369bad9b39..20f745e1799f 100644 --- a/dotnet/src/VectorData/SqliteVec/SqlitePropertyMapping.cs +++ b/dotnet/src/VectorData/SqliteVec/SqlitePropertyMapping.cs @@ -107,9 +107,12 @@ private static string GetStorageDataPropertyType(PropertyModel property) // String type Type t when t == typeof(string) => "TEXT", - // Boolean types - SQLite doesn't have a boolean type, represent it as 0/1 + // Boolean type - represent it as INTEGER (0/1 (this is standard SQLite) Type t when t == typeof(bool) || t == typeof(bool?) => "INTEGER", + // Guid type - represent as TEXT + Type t when t == typeof(Guid) || t == typeof(Guid?) => "TEXT", + // Byte array (BLOB) Type t when t == typeof(byte[]) => "BLOB", diff --git a/dotnet/test/VectorData/AzureAISearch.ConformanceTests/ModelTests/AzureAISearchAllSupportedTypesTests.cs b/dotnet/test/VectorData/AzureAISearch.ConformanceTests/ModelTests/AzureAISearchAllSupportedTypesTests.cs deleted file mode 100644 index 001506c722c7..000000000000 --- a/dotnet/test/VectorData/AzureAISearch.ConformanceTests/ModelTests/AzureAISearchAllSupportedTypesTests.cs +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. - -using AzureAISearch.ConformanceTests.Support; -using Microsoft.Extensions.VectorData; -using VectorData.ConformanceTests.Xunit; -using Xunit; - -namespace AzureAISearch.ConformanceTests.CRUD; - -public class AzureAISearchAllSupportedTypesTests(AzureAISearchFixture fixture) : IClassFixture -{ - [ConditionalFact] - public async Task AllTypesBatchGetAsync() - { - var collection = fixture.TestStore.DefaultVectorStore.GetCollection("all-types", AzureAISearchAllTypes.GetRecordDefinition()); - await collection.EnsureCollectionExistsAsync(); - - List records = - [ - new() - { - Id = "all-types-1", - BoolProperty = true, - NullableBoolProperty = false, - StringProperty = "string prop 1", - NullableStringProperty = "nullable prop 1", - IntProperty = 1, - NullableIntProperty = 10, - LongProperty = 100L, - NullableLongProperty = 1000L, - FloatProperty = 10.5f, - NullableFloatProperty = 100.5f, - DoubleProperty = 23.75d, - NullableDoubleProperty = 233.75d, - DateTimeOffsetProperty = DateTimeOffset.UtcNow, - NullableDateTimeOffsetProperty = DateTimeOffset.UtcNow, - StringArray = ["one", "two"], - StringList = ["eleven", "twelve"], - BoolArray = [true, false], - BoolList = [true, false], - IntArray = [1, 2], - IntList = [11, 12], - LongArray = [100L, 200L], - LongList = [1100L, 1200L], - FloatArray = [1.5f, 2.5f], - FloatList = [11.5f, 12.5f], - DoubleArray = [1.5d, 2.5d], - DoubleList = [11.5d, 12.5d], - DateTimeOffsetArray = [DateTimeOffset.UtcNow, DateTimeOffset.UtcNow], - DateTimeOffsetList = [DateTimeOffset.UtcNow, DateTimeOffset.UtcNow], - Embedding = new ReadOnlyMemory([1.5f, 2.5f, 3.5f, 4.5f, 5.5f, 6.5f, 7.5f, 8.5f]) - }, - new() - { - Id = "all-types-2", - BoolProperty = false, - NullableBoolProperty = null, - StringProperty = "string prop 2", - NullableStringProperty = null, - IntProperty = 2, - NullableIntProperty = null, - LongProperty = 200L, - NullableLongProperty = null, - FloatProperty = 20.5f, - NullableFloatProperty = null, - DoubleProperty = 43.75, - NullableDoubleProperty = null, - Embedding = ReadOnlyMemory.Empty, - // From https://learn.microsoft.com/en-us/rest/api/searchservice/supported-data-types: - // "All of the above types are nullable, except for collections of primitive and complex types, for example, Collection(Edm.String)" - // So for collections, we can't use nulls. - StringArray = [], - StringList = [], - BoolArray = [], - BoolList = [], - IntArray = [], - IntList = [], - LongArray = [], - LongList = [], - FloatArray = [], - FloatList = [], - DoubleArray = [], - DoubleList = [], - DateTimeOffsetArray = [], - DateTimeOffsetList = [], - } - ]; - - try - { - await collection.UpsertAsync(records); - - var allTypes = await collection.GetAsync(records.Select(r => r.Id), new RecordRetrievalOptions { IncludeVectors = true }).ToListAsync(); - - var allTypes1 = allTypes.Single(x => x.Id == records[0].Id); - var allTypes2 = allTypes.Single(x => x.Id == records[1].Id); - - records[0].AssertEqual(allTypes1); - records[1].AssertEqual(allTypes2); - } - finally - { - await collection.EnsureCollectionDeletedAsync(); - } - } -} diff --git a/dotnet/test/VectorData/AzureAISearch.ConformanceTests/AzureAISearchDataTypeTests.cs b/dotnet/test/VectorData/AzureAISearch.ConformanceTests/TypeTests/AzureAISearchDataTypeTests.cs similarity index 97% rename from dotnet/test/VectorData/AzureAISearch.ConformanceTests/AzureAISearchDataTypeTests.cs rename to dotnet/test/VectorData/AzureAISearch.ConformanceTests/TypeTests/AzureAISearchDataTypeTests.cs index be9fe82afc9f..dac0fe2e88f0 100644 --- a/dotnet/test/VectorData/AzureAISearch.ConformanceTests/AzureAISearchDataTypeTests.cs +++ b/dotnet/test/VectorData/AzureAISearch.ConformanceTests/TypeTests/AzureAISearchDataTypeTests.cs @@ -2,12 +2,12 @@ using AzureAISearch.ConformanceTests.Support; using Microsoft.Extensions.VectorData; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using VectorData.ConformanceTests.Xunit; using Xunit; -namespace AzureAISearch.ConformanceTests; +namespace AzureAISearch.ConformanceTests.TypeTests; public class AzureAISearchDataTypeTests(AzureAISearchDataTypeTests.Fixture fixture) : DataTypeTests(fixture), diff --git a/dotnet/test/VectorData/AzureAISearch.ConformanceTests/AzureAISearchEmbeddingTypeTests.cs b/dotnet/test/VectorData/AzureAISearch.ConformanceTests/TypeTests/AzureAISearchEmbeddingTypeTests.cs similarity index 88% rename from dotnet/test/VectorData/AzureAISearch.ConformanceTests/AzureAISearchEmbeddingTypeTests.cs rename to dotnet/test/VectorData/AzureAISearch.ConformanceTests/TypeTests/AzureAISearchEmbeddingTypeTests.cs index 795dd8869df4..b6a4483555d0 100644 --- a/dotnet/test/VectorData/AzureAISearch.ConformanceTests/AzureAISearchEmbeddingTypeTests.cs +++ b/dotnet/test/VectorData/AzureAISearch.ConformanceTests/TypeTests/AzureAISearchEmbeddingTypeTests.cs @@ -1,13 +1,13 @@ // Copyright (c) Microsoft. All rights reserved. using AzureAISearch.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Xunit; #pragma warning disable CA2000 // Dispose objects before losing scope -namespace AzureAISearch.ConformanceTests; +namespace AzureAISearch.ConformanceTests.TypeTests; public class AzureAISearchEmbeddingTypeTests(AzureAISearchEmbeddingTypeTests.Fixture fixture) : EmbeddingTypeTests(fixture), IClassFixture diff --git a/dotnet/test/VectorData/AzureAISearch.ConformanceTests/TypeTests/AzureAISearchKeyTypeTests.cs b/dotnet/test/VectorData/AzureAISearch.ConformanceTests/TypeTests/AzureAISearchKeyTypeTests.cs new file mode 100644 index 000000000000..f14287669685 --- /dev/null +++ b/dotnet/test/VectorData/AzureAISearch.ConformanceTests/TypeTests/AzureAISearchKeyTypeTests.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft. All rights reserved. + +using AzureAISearch.ConformanceTests.Support; +using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; +using VectorData.ConformanceTests.Xunit; +using Xunit; + +namespace AzureAISearch.ConformanceTests.TypeTests; + +public class AzureAISearchKeyTypeTests(AzureAISearchKeyTypeTests.Fixture fixture) + : KeyTypeTests(fixture), IClassFixture +{ + [ConditionalFact] + public virtual Task String() => this.Test("foo"); + + public new class Fixture : KeyTypeTests.Fixture + { + public override TestStore TestStore => AzureAISearchTestStore.Instance; + + // Azure AI search only supports lowercase letters, digits or dashes. + public override string CollectionName => "key-type-tests" + AzureAISearchTestEnvironment.TestIndexPostfix; + } +} diff --git a/dotnet/test/VectorData/CosmosMongoDB.ConformanceTests/CosmosMongoDataTypeTests.cs b/dotnet/test/VectorData/CosmosMongoDB.ConformanceTests/TypeTests/CosmosMongoDataTypeTests.cs similarity index 94% rename from dotnet/test/VectorData/CosmosMongoDB.ConformanceTests/CosmosMongoDataTypeTests.cs rename to dotnet/test/VectorData/CosmosMongoDB.ConformanceTests/TypeTests/CosmosMongoDataTypeTests.cs index 789a54a76ba3..0ba4de3cecf5 100644 --- a/dotnet/test/VectorData/CosmosMongoDB.ConformanceTests/CosmosMongoDataTypeTests.cs +++ b/dotnet/test/VectorData/CosmosMongoDB.ConformanceTests/TypeTests/CosmosMongoDataTypeTests.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft. All rights reserved. using CosmosMongoDB.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Xunit; -namespace CosmosMongoDB.ConformanceTests; +namespace CosmosMongoDB.ConformanceTests.TypeTests; public class CosmosMongoDataTypeTests(CosmosMongoDataTypeTests.Fixture fixture) : DataTypeTests.DefaultRecord>(fixture), IClassFixture diff --git a/dotnet/test/VectorData/CosmosMongoDB.ConformanceTests/CosmosMongoEmbeddingTypeTests.cs b/dotnet/test/VectorData/CosmosMongoDB.ConformanceTests/TypeTests/CosmosMongoEmbeddingTypeTests.cs similarity index 85% rename from dotnet/test/VectorData/CosmosMongoDB.ConformanceTests/CosmosMongoEmbeddingTypeTests.cs rename to dotnet/test/VectorData/CosmosMongoDB.ConformanceTests/TypeTests/CosmosMongoEmbeddingTypeTests.cs index 12e6241bd22f..708989399d28 100644 --- a/dotnet/test/VectorData/CosmosMongoDB.ConformanceTests/CosmosMongoEmbeddingTypeTests.cs +++ b/dotnet/test/VectorData/CosmosMongoDB.ConformanceTests/TypeTests/CosmosMongoEmbeddingTypeTests.cs @@ -1,13 +1,13 @@ // Copyright (c) Microsoft. All rights reserved. using CosmosMongoDB.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Xunit; #pragma warning disable CA2000 // Dispose objects before losing scope -namespace CosmosMongoDB.ConformanceTests; +namespace CosmosMongoDB.ConformanceTests.TypeTests; public class CosmosMongoEmbeddingTypeTests(CosmosMongoEmbeddingTypeTests.Fixture fixture) : EmbeddingTypeTests(fixture), IClassFixture diff --git a/dotnet/test/VectorData/CosmosMongoDB.ConformanceTests/TypeTests/CosmosMongoKeyTypeTests.cs b/dotnet/test/VectorData/CosmosMongoDB.ConformanceTests/TypeTests/CosmosMongoKeyTypeTests.cs new file mode 100644 index 000000000000..9aa3c1a14a04 --- /dev/null +++ b/dotnet/test/VectorData/CosmosMongoDB.ConformanceTests/TypeTests/CosmosMongoKeyTypeTests.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. + +using CosmosMongoDB.ConformanceTests.Support; +using MongoDB.Bson; +using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; +using VectorData.ConformanceTests.Xunit; +using Xunit; + +namespace CosmosMongoDB.ConformanceTests.TypeTests; + +public class CosmosMongoKeyTypeTests(CosmosMongoKeyTypeTests.Fixture fixture) + : KeyTypeTests(fixture), IClassFixture +{ + [ConditionalFact] + public virtual Task ObjectId() => this.Test(new("652f8c3e8f9b2c1a4d3e6a7b")); + + [ConditionalFact] + public virtual Task String() => this.Test("foo"); + + [ConditionalFact] + public virtual Task Int() => this.Test(8); + + [ConditionalFact] + public virtual Task Long() => this.Test(8L); + + public new class Fixture : KeyTypeTests.Fixture + { + public override TestStore TestStore => CosmosMongoTestStore.Instance; + } +} diff --git a/dotnet/test/VectorData/CosmosMongoDB.UnitTests/CosmosMongoVectorStoreTests.cs b/dotnet/test/VectorData/CosmosMongoDB.UnitTests/CosmosMongoVectorStoreTests.cs index 9e7bbbf68fe6..684226062b12 100644 --- a/dotnet/test/VectorData/CosmosMongoDB.UnitTests/CosmosMongoVectorStoreTests.cs +++ b/dotnet/test/VectorData/CosmosMongoDB.UnitTests/CosmosMongoVectorStoreTests.cs @@ -26,7 +26,7 @@ public void GetCollectionWithNotSupportedKeyThrowsException() using var sut = new CosmosMongoVectorStore(this._mockMongoDatabase.Object); // Act & Assert - Assert.Throws(() => sut.GetCollection("collection")); + Assert.Throws(() => sut.GetCollection("collection")); } [Fact] diff --git a/dotnet/test/VectorData/CosmosNoSql.ConformanceTests/CosmosNoSqlDataTypeTests.cs b/dotnet/test/VectorData/CosmosNoSql.ConformanceTests/TypeTests/CosmosNoSqlDataTypeTests.cs similarity index 94% rename from dotnet/test/VectorData/CosmosNoSql.ConformanceTests/CosmosNoSqlDataTypeTests.cs rename to dotnet/test/VectorData/CosmosNoSql.ConformanceTests/TypeTests/CosmosNoSqlDataTypeTests.cs index e4b541c631f5..e1a81b36b714 100644 --- a/dotnet/test/VectorData/CosmosNoSql.ConformanceTests/CosmosNoSqlDataTypeTests.cs +++ b/dotnet/test/VectorData/CosmosNoSql.ConformanceTests/TypeTests/CosmosNoSqlDataTypeTests.cs @@ -1,12 +1,12 @@ // Copyright (c) Microsoft. All rights reserved. using CosmosNoSql.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using VectorData.ConformanceTests.Xunit; using Xunit; -namespace CosmosNoSql.ConformanceTests; +namespace CosmosNoSql.ConformanceTests.TypeTests; public class CosmosNoSqlDataTypeTests(CosmosNoSqlDataTypeTests.Fixture fixture) : DataTypeTests.DefaultRecord>(fixture), IClassFixture diff --git a/dotnet/test/VectorData/CosmosNoSql.ConformanceTests/CosmosNoSqlEmbeddingTypeTests.cs b/dotnet/test/VectorData/CosmosNoSql.ConformanceTests/TypeTests/CosmosNoSqlEmbeddingTypeTests.cs similarity index 96% rename from dotnet/test/VectorData/CosmosNoSql.ConformanceTests/CosmosNoSqlEmbeddingTypeTests.cs rename to dotnet/test/VectorData/CosmosNoSql.ConformanceTests/TypeTests/CosmosNoSqlEmbeddingTypeTests.cs index 7ab3dd9318aa..2601cfbe6c7d 100644 --- a/dotnet/test/VectorData/CosmosNoSql.ConformanceTests/CosmosNoSqlEmbeddingTypeTests.cs +++ b/dotnet/test/VectorData/CosmosNoSql.ConformanceTests/TypeTests/CosmosNoSqlEmbeddingTypeTests.cs @@ -2,14 +2,14 @@ using CosmosNoSql.ConformanceTests.Support; using Microsoft.Extensions.AI; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using VectorData.ConformanceTests.Xunit; using Xunit; #pragma warning disable CA2000 // Dispose objects before losing scope -namespace CosmosNoSql.ConformanceTests; +namespace CosmosNoSql.ConformanceTests.TypeTests; public class CosmosNoSqlEmbeddingTypeTests(CosmosNoSqlEmbeddingTypeTests.Fixture fixture) : EmbeddingTypeTests(fixture), IClassFixture diff --git a/dotnet/test/VectorData/CosmosNoSql.ConformanceTests/TypeTests/CosmosNoSqlKeyTypeTests.cs b/dotnet/test/VectorData/CosmosNoSql.ConformanceTests/TypeTests/CosmosNoSqlKeyTypeTests.cs new file mode 100644 index 000000000000..88939622f757 --- /dev/null +++ b/dotnet/test/VectorData/CosmosNoSql.ConformanceTests/TypeTests/CosmosNoSqlKeyTypeTests.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft. All rights reserved. + +using CosmosNoSql.ConformanceTests.Support; +using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; +using VectorData.ConformanceTests.Xunit; +using Xunit; + +namespace CosmosNoSql.ConformanceTests.TypeTests; + +public class CosmosNoSqlKeyTypeTests(CosmosNoSqlKeyTypeTests.Fixture fixture) + : KeyTypeTests(fixture), IClassFixture +{ + [ConditionalFact] + public virtual Task String() => this.Test("foo"); + + public new class Fixture : KeyTypeTests.Fixture + { + public override TestStore TestStore => CosmosNoSqlTestStore.Instance; + } +} diff --git a/dotnet/test/VectorData/CosmosNoSql.UnitTests/CosmosNoSqlVectorStoreTests.cs b/dotnet/test/VectorData/CosmosNoSql.UnitTests/CosmosNoSqlVectorStoreTests.cs index 2b6c50e3b2c9..5f8f20cf865c 100644 --- a/dotnet/test/VectorData/CosmosNoSql.UnitTests/CosmosNoSqlVectorStoreTests.cs +++ b/dotnet/test/VectorData/CosmosNoSql.UnitTests/CosmosNoSqlVectorStoreTests.cs @@ -38,7 +38,7 @@ public void GetCollectionWithNotSupportedKeyThrowsException() using var sut = new Microsoft.SemanticKernel.Connectors.CosmosNoSql.CosmosNoSqlVectorStore(this._mockDatabase.Object); // Act & Assert - Assert.Throws(() => sut.GetCollection("collection")); + Assert.Throws(() => sut.GetCollection("collection")); } [Fact] diff --git a/dotnet/test/VectorData/InMemory.ConformanceTests/InMemoryDataTypeTests.cs b/dotnet/test/VectorData/InMemory.ConformanceTests/TypeTests/InMemoryDataTypeTests.cs similarity index 86% rename from dotnet/test/VectorData/InMemory.ConformanceTests/InMemoryDataTypeTests.cs rename to dotnet/test/VectorData/InMemory.ConformanceTests/TypeTests/InMemoryDataTypeTests.cs index d0e47b840f93..3739bbdd4c52 100644 --- a/dotnet/test/VectorData/InMemory.ConformanceTests/InMemoryDataTypeTests.cs +++ b/dotnet/test/VectorData/InMemory.ConformanceTests/TypeTests/InMemoryDataTypeTests.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft. All rights reserved. using InMemory.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Xunit; -namespace InMemory.ConformanceTests; +namespace InMemory.ConformanceTests.TypeTests; public class InMemoryDataTypeTests(InMemoryDataTypeTests.Fixture fixture) : DataTypeTests.DefaultRecord>(fixture), IClassFixture diff --git a/dotnet/test/VectorData/InMemory.ConformanceTests/InMemoryEmbeddingTypeTests.cs b/dotnet/test/VectorData/InMemory.ConformanceTests/TypeTests/InMemoryEmbeddingTypeTests.cs similarity index 88% rename from dotnet/test/VectorData/InMemory.ConformanceTests/InMemoryEmbeddingTypeTests.cs rename to dotnet/test/VectorData/InMemory.ConformanceTests/TypeTests/InMemoryEmbeddingTypeTests.cs index fcdd51f0c54d..fa839fffcc4f 100644 --- a/dotnet/test/VectorData/InMemory.ConformanceTests/InMemoryEmbeddingTypeTests.cs +++ b/dotnet/test/VectorData/InMemory.ConformanceTests/TypeTests/InMemoryEmbeddingTypeTests.cs @@ -1,13 +1,13 @@ // Copyright (c) Microsoft. All rights reserved. using InMemory.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Xunit; #pragma warning disable CA2000 // Dispose objects before losing scope -namespace InMemory.ConformanceTests; +namespace InMemory.ConformanceTests.TypeTests; public class InMemoryEmbeddingTypeTests(InMemoryEmbeddingTypeTests.Fixture fixture) : EmbeddingTypeTests(fixture), IClassFixture diff --git a/dotnet/test/VectorData/InMemory.ConformanceTests/TypeTests/InMemoryKeyTypeTests.cs b/dotnet/test/VectorData/InMemory.ConformanceTests/TypeTests/InMemoryKeyTypeTests.cs new file mode 100644 index 000000000000..1f092d34c59e --- /dev/null +++ b/dotnet/test/VectorData/InMemory.ConformanceTests/TypeTests/InMemoryKeyTypeTests.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft. All rights reserved. + +using InMemory.ConformanceTests.Support; +using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; +using VectorData.ConformanceTests.Xunit; +using Xunit; + +namespace InMemory.ConformanceTests.TypeTests; + +public class InMemoryKeyTypeTests(InMemoryKeyTypeTests.Fixture fixture) + : KeyTypeTests(fixture), IClassFixture +{ + // The InMemory provider supports all .NET types as keys; below are just a few basic tests. + + [ConditionalFact] + public virtual Task Int() => this.Test(8); + + [ConditionalFact] + public virtual Task Long() => this.Test(8L); + + [ConditionalFact] + public virtual Task String() => this.Test("foo"); + + protected override async Task Test(TKey mainValue) + { + await base.Test(mainValue); + + // For InMemory, delete the collection, otherwise the next test that runs will fail because the collection + // already exists but with the previous key type. + using var collection = fixture.CreateCollection(); + await collection.EnsureCollectionDeletedAsync(); + } + + public new class Fixture : KeyTypeTests.Fixture + { + public override TestStore TestStore => InMemoryTestStore.Instance; + } +} diff --git a/dotnet/test/VectorData/MongoDB.ConformanceTests/MongoDataTypeTests.cs b/dotnet/test/VectorData/MongoDB.ConformanceTests/TypeTests/MongoDataTypeTests.cs similarity index 95% rename from dotnet/test/VectorData/MongoDB.ConformanceTests/MongoDataTypeTests.cs rename to dotnet/test/VectorData/MongoDB.ConformanceTests/TypeTests/MongoDataTypeTests.cs index 6a9361bbff28..8305e4a557c6 100644 --- a/dotnet/test/VectorData/MongoDB.ConformanceTests/MongoDataTypeTests.cs +++ b/dotnet/test/VectorData/MongoDB.ConformanceTests/TypeTests/MongoDataTypeTests.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft. All rights reserved. using MongoDB.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Xunit; -namespace MongoDB.ConformanceTests; +namespace MongoDB.ConformanceTests.TypeTests; public class MongoDataTypeTests(MongoDataTypeTests.Fixture fixture) : DataTypeTests.DefaultRecord>(fixture), IClassFixture diff --git a/dotnet/test/VectorData/MongoDB.ConformanceTests/MongoEmbeddingTypeTests.cs b/dotnet/test/VectorData/MongoDB.ConformanceTests/TypeTests/MongoEmbeddingTypeTests.cs similarity index 85% rename from dotnet/test/VectorData/MongoDB.ConformanceTests/MongoEmbeddingTypeTests.cs rename to dotnet/test/VectorData/MongoDB.ConformanceTests/TypeTests/MongoEmbeddingTypeTests.cs index 4500ed138490..224c16a9889c 100644 --- a/dotnet/test/VectorData/MongoDB.ConformanceTests/MongoEmbeddingTypeTests.cs +++ b/dotnet/test/VectorData/MongoDB.ConformanceTests/TypeTests/MongoEmbeddingTypeTests.cs @@ -1,13 +1,13 @@ // Copyright (c) Microsoft. All rights reserved. using MongoDB.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Xunit; #pragma warning disable CA2000 // Dispose objects before losing scope -namespace MongoDB.ConformanceTests; +namespace MongoDB.ConformanceTests.TypeTests; public class MongoEmbeddingTypeTests(MongoEmbeddingTypeTests.Fixture fixture) : EmbeddingTypeTests(fixture), IClassFixture diff --git a/dotnet/test/VectorData/MongoDB.ConformanceTests/TypeTests/MongoKeyTypeTests.cs b/dotnet/test/VectorData/MongoDB.ConformanceTests/TypeTests/MongoKeyTypeTests.cs new file mode 100644 index 000000000000..aab5bb71196e --- /dev/null +++ b/dotnet/test/VectorData/MongoDB.ConformanceTests/TypeTests/MongoKeyTypeTests.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. + +using MongoDB.Bson; +using MongoDB.ConformanceTests.Support; +using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; +using VectorData.ConformanceTests.Xunit; +using Xunit; + +namespace MongoDB.ConformanceTests.TypeTests; + +public class MongoKeyTypeTests(MongoKeyTypeTests.Fixture fixture) + : KeyTypeTests(fixture), IClassFixture +{ + [ConditionalFact] + public virtual Task ObjectId() => this.Test(new("652f8c3e8f9b2c1a4d3e6a7b")); + + [ConditionalFact] + public virtual Task String() => this.Test("foo"); + + [ConditionalFact] + public virtual Task Int() => this.Test(8); + + [ConditionalFact] + public virtual Task Long() => this.Test(8L); + + public new class Fixture : KeyTypeTests.Fixture + { + public override TestStore TestStore => MongoTestStore.Instance; + } +} diff --git a/dotnet/test/VectorData/MongoDB.UnitTests/MongoVectorStoreTests.cs b/dotnet/test/VectorData/MongoDB.UnitTests/MongoVectorStoreTests.cs index ee2754342390..5a3e4238a020 100644 --- a/dotnet/test/VectorData/MongoDB.UnitTests/MongoVectorStoreTests.cs +++ b/dotnet/test/VectorData/MongoDB.UnitTests/MongoVectorStoreTests.cs @@ -26,7 +26,7 @@ public void GetCollectionWithNotSupportedKeyThrowsException() using var sut = new MongoVectorStore(this._mockMongoDatabase.Object); // Act & Assert - Assert.Throws(() => sut.GetCollection("collection")); + Assert.Throws(() => sut.GetCollection("collection")); } [Fact] diff --git a/dotnet/test/VectorData/PgVector.ConformanceTests/PostgresDataTypeTests.cs b/dotnet/test/VectorData/PgVector.ConformanceTests/TypeTests/PostgresDataTypeTests.cs similarity index 92% rename from dotnet/test/VectorData/PgVector.ConformanceTests/PostgresDataTypeTests.cs rename to dotnet/test/VectorData/PgVector.ConformanceTests/TypeTests/PostgresDataTypeTests.cs index 53245b2e089e..faec9f0323a5 100644 --- a/dotnet/test/VectorData/PgVector.ConformanceTests/PostgresDataTypeTests.cs +++ b/dotnet/test/VectorData/PgVector.ConformanceTests/TypeTests/PostgresDataTypeTests.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft. All rights reserved. using PgVector.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Xunit; -namespace PgVector.ConformanceTests; +namespace PgVector.ConformanceTests.TypeTests; public class PostgresDataTypeTests(PostgresDataTypeTests.Fixture fixture) : DataTypeTests.DefaultRecord>(fixture), IClassFixture diff --git a/dotnet/test/VectorData/PgVector.ConformanceTests/PostgresEmbeddingTypeTests.cs b/dotnet/test/VectorData/PgVector.ConformanceTests/TypeTests/PostgresEmbeddingTypeTests.cs similarity index 96% rename from dotnet/test/VectorData/PgVector.ConformanceTests/PostgresEmbeddingTypeTests.cs rename to dotnet/test/VectorData/PgVector.ConformanceTests/TypeTests/PostgresEmbeddingTypeTests.cs index 2e7b19692dfe..f5a03484e4fc 100644 --- a/dotnet/test/VectorData/PgVector.ConformanceTests/PostgresEmbeddingTypeTests.cs +++ b/dotnet/test/VectorData/PgVector.ConformanceTests/TypeTests/PostgresEmbeddingTypeTests.cs @@ -7,14 +7,14 @@ using Microsoft.Extensions.VectorData; using Pgvector; using PgVector.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using VectorData.ConformanceTests.Xunit; using Xunit; #pragma warning disable CA2000 // Dispose objects before losing scope -namespace PgVector.ConformanceTests; +namespace PgVector.ConformanceTests.TypeTests; public class PostgresEmbeddingTypeTests(PostgresEmbeddingTypeTests.Fixture fixture) : EmbeddingTypeTests(fixture), IClassFixture diff --git a/dotnet/test/VectorData/PgVector.ConformanceTests/TypeTests/PostgresKeyTypeTests.cs b/dotnet/test/VectorData/PgVector.ConformanceTests/TypeTests/PostgresKeyTypeTests.cs new file mode 100644 index 000000000000..7a76eb38615f --- /dev/null +++ b/dotnet/test/VectorData/PgVector.ConformanceTests/TypeTests/PostgresKeyTypeTests.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft. All rights reserved. + +using PgVector.ConformanceTests.Support; +using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; +using VectorData.ConformanceTests.Xunit; +using Xunit; + +namespace PgVector.ConformanceTests.TypeTests; + +public class PostgresKeyTypeTests(PostgresKeyTypeTests.Fixture fixture) + : KeyTypeTests(fixture), IClassFixture +{ + [ConditionalFact] + public virtual Task Int() => this.Test(8); + + [ConditionalFact] + public virtual Task Long() => this.Test(8L); + + [ConditionalFact] + public virtual Task String() => this.Test("foo"); + + public new class Fixture : KeyTypeTests.Fixture + { + public override TestStore TestStore => PostgresTestStore.Instance; + } +} diff --git a/dotnet/test/VectorData/Pinecone.ConformanceTests/PineconeAllSupportedTypesTests.cs b/dotnet/test/VectorData/Pinecone.ConformanceTests/PineconeAllSupportedTypesTests.cs index d54068198d56..849425659895 100644 --- a/dotnet/test/VectorData/Pinecone.ConformanceTests/PineconeAllSupportedTypesTests.cs +++ b/dotnet/test/VectorData/Pinecone.ConformanceTests/PineconeAllSupportedTypesTests.cs @@ -5,7 +5,7 @@ using VectorData.ConformanceTests.Xunit; using Xunit; -namespace Pinecone.ConformanceTests.CRUD; +namespace Pinecone.ConformanceTests; public class PineconeAllSupportedTypesTests(PineconeFixture fixture) : IClassFixture { diff --git a/dotnet/test/VectorData/Pinecone.ConformanceTests/PineconeFilterTests.cs b/dotnet/test/VectorData/Pinecone.ConformanceTests/PineconeFilterTests.cs index 0342d871af29..bbaa5e6b872b 100644 --- a/dotnet/test/VectorData/Pinecone.ConformanceTests/PineconeFilterTests.cs +++ b/dotnet/test/VectorData/Pinecone.ConformanceTests/PineconeFilterTests.cs @@ -24,19 +24,19 @@ public virtual Task Not_over_Contains() // Pinecone currently doesn't support null checking ({ "Foo" : null }) in vector search pre-filters public override Task Equal_with_null_reference_type() - => Assert.ThrowsAsync(() => base.Equal_with_null_reference_type()); + => Assert.ThrowsAsync(base.Equal_with_null_reference_type); public override Task Equal_with_null_captured() - => Assert.ThrowsAsync(() => base.Equal_with_null_captured()); + => Assert.ThrowsAsync(base.Equal_with_null_captured); public override Task NotEqual_with_null_reference_type() - => Assert.ThrowsAsync(() => base.NotEqual_with_null_reference_type()); + => Assert.ThrowsAsync(base.NotEqual_with_null_reference_type); public override Task NotEqual_with_null_captured() - => Assert.ThrowsAsync(() => base.NotEqual_with_null_captured()); + => Assert.ThrowsAsync(base.NotEqual_with_null_captured); public override Task Equal_int_property_with_null_nullable_int() - => Assert.ThrowsAsync(() => base.Equal_int_property_with_null_nullable_int()); + => Assert.ThrowsAsync(base.Equal_int_property_with_null_nullable_int); #endregion @@ -45,27 +45,42 @@ public override Task Equal_int_property_with_null_nullable_int() // Pinecone currently doesn't support NOT in vector search pre-filters // (https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/#atlas-vector-search-pre-filter) public override Task Not_over_And() - => Assert.ThrowsAsync(() => base.Not_over_And()); + => Assert.ThrowsAsync(base.Not_over_And); public override Task Not_over_Or() - => Assert.ThrowsAsync(() => base.Not_over_Or()); + => Assert.ThrowsAsync(base.Not_over_Or); #endregion public override Task Contains_over_field_string_array() - => Assert.ThrowsAsync(() => base.Contains_over_field_string_array()); + => Assert.ThrowsAsync(base.Contains_over_field_string_array); public override Task Contains_over_field_string_List() - => Assert.ThrowsAsync(() => base.Contains_over_field_string_List()); + => Assert.ThrowsAsync(base.Contains_over_field_string_List); + + // List fields not (currently) supported on SQLite (see #10343) + public override Task Contains_with_Enumerable_Contains() + => Assert.ThrowsAsync(base.Contains_with_Enumerable_Contains); + +#if !NETFRAMEWORK + // List fields not (currently) supported on SQLite (see #10343) + public override Task Contains_with_MemoryExtensions_Contains() + => Assert.ThrowsAsync(base.Contains_with_MemoryExtensions_Contains); +#endif + +#if NET10_0_OR_GREATER + public override Task Contains_with_MemoryExtensions_Contains_with_null_comparer() + => Assert.ThrowsAsync(base.Contains_with_MemoryExtensions_Contains_with_null_comparer); +#endif // AnyTagEqualTo not (currently) supported on Pinecone [Obsolete("Legacy filter support")] public override Task Legacy_AnyTagEqualTo_array() - => Assert.ThrowsAsync(() => base.Legacy_AnyTagEqualTo_array()); + => Assert.ThrowsAsync(base.Legacy_AnyTagEqualTo_array); [Obsolete("Legacy filter support")] public override Task Legacy_AnyTagEqualTo_List() - => Assert.ThrowsAsync(() => base.Legacy_AnyTagEqualTo_List()); + => Assert.ThrowsAsync(base.Legacy_AnyTagEqualTo_List); public new class Fixture : FilterTests.Fixture { diff --git a/dotnet/test/VectorData/Pinecone.ConformanceTests/TestModels/PineconeBasicModelTests.cs b/dotnet/test/VectorData/Pinecone.ConformanceTests/TestModels/PineconeBasicModelTests.cs index 859542eead00..56cd4d765d24 100644 --- a/dotnet/test/VectorData/Pinecone.ConformanceTests/TestModels/PineconeBasicModelTests.cs +++ b/dotnet/test/VectorData/Pinecone.ConformanceTests/TestModels/PineconeBasicModelTests.cs @@ -10,8 +10,29 @@ namespace Pinecone.ConformanceTests.ModelTests; public class PineconeBasicModelTests(PineconeBasicModelTests.Fixture fixture) : BasicModelTests(fixture), IClassFixture { + public override async Task GetAsync_with_filter_and_OrderBy() + { + var exception = await Assert.ThrowsAsync(base.GetAsync_with_filter_and_OrderBy); + Assert.Equal("Pinecone does not support ordering.", exception.Message); + } + + public override async Task GetAsync_with_filter_and_multiple_OrderBys() + { + var exception = await Assert.ThrowsAsync(base.GetAsync_with_filter_and_multiple_OrderBys); + Assert.Equal("Pinecone does not support ordering.", exception.Message); + } + + public override async Task GetAsync_with_filter_and_OrderBy_and_Skip() + { + var exception = await Assert.ThrowsAsync(base.GetAsync_with_filter_and_OrderBy_and_Skip); + Assert.Equal("Pinecone does not support ordering.", exception.Message); + } + public new class Fixture : BasicModelTests.Fixture { public override TestStore TestStore => PineconeTestStore.Instance; + + // https://docs.pinecone.io/troubleshooting/restrictions-on-index-names + public override string CollectionName => "basic-model-tests"; } } diff --git a/dotnet/test/VectorData/Pinecone.ConformanceTests/TestModels/PineconeDynamicModelTests.cs b/dotnet/test/VectorData/Pinecone.ConformanceTests/TestModels/PineconeDynamicModelTests.cs index c4aff04e3165..bedaf4715c97 100644 --- a/dotnet/test/VectorData/Pinecone.ConformanceTests/TestModels/PineconeDynamicModelTests.cs +++ b/dotnet/test/VectorData/Pinecone.ConformanceTests/TestModels/PineconeDynamicModelTests.cs @@ -10,8 +10,29 @@ namespace Pinecone.ConformanceTests.ModelTests; public class PineconeDynamicModelTests(PineconeDynamicModelTests.Fixture fixture) : DynamicModelTests(fixture), IClassFixture { + public override async Task GetAsync_with_filter_and_OrderBy() + { + var exception = await Assert.ThrowsAsync(base.GetAsync_with_filter_and_OrderBy); + Assert.Equal("Pinecone does not support ordering.", exception.Message); + } + + public override async Task GetAsync_with_filter_and_multiple_OrderBys() + { + var exception = await Assert.ThrowsAsync(base.GetAsync_with_filter_and_multiple_OrderBys); + Assert.Equal("Pinecone does not support ordering.", exception.Message); + } + + public override async Task GetAsync_with_filter_and_OrderBy_and_Skip() + { + var exception = await Assert.ThrowsAsync(base.GetAsync_with_filter_and_OrderBy_and_Skip); + Assert.Equal("Pinecone does not support ordering.", exception.Message); + } + public new class Fixture : DynamicModelTests.Fixture { public override TestStore TestStore => PineconeTestStore.Instance; + + // https://docs.pinecone.io/troubleshooting/restrictions-on-index-names + public override string CollectionName => "dynamic-model-tests"; } } diff --git a/dotnet/test/VectorData/Pinecone.ConformanceTests/TestModels/PineconeNoDataModelTests.cs b/dotnet/test/VectorData/Pinecone.ConformanceTests/TestModels/PineconeNoDataModelTests.cs index c17149dcdfd1..be8588e29e0e 100644 --- a/dotnet/test/VectorData/Pinecone.ConformanceTests/TestModels/PineconeNoDataModelTests.cs +++ b/dotnet/test/VectorData/Pinecone.ConformanceTests/TestModels/PineconeNoDataModelTests.cs @@ -13,5 +13,8 @@ public class PineconeNoDataModelTests(PineconeNoDataModelTests.Fixture fixture) public new class Fixture : NoDataModelTests.Fixture { public override TestStore TestStore => PineconeTestStore.Instance; + + // https://docs.pinecone.io/troubleshooting/restrictions-on-index-names + public override string CollectionName => "no-data-model-tests"; } } diff --git a/dotnet/test/VectorData/Pinecone.ConformanceTests/PineconeDataTypeTests.cs b/dotnet/test/VectorData/Pinecone.ConformanceTests/TypeTests/PineconeDataTypeTests.cs similarity index 93% rename from dotnet/test/VectorData/Pinecone.ConformanceTests/PineconeDataTypeTests.cs rename to dotnet/test/VectorData/Pinecone.ConformanceTests/TypeTests/PineconeDataTypeTests.cs index ade59387ebf5..f9bb6eeed2cf 100644 --- a/dotnet/test/VectorData/Pinecone.ConformanceTests/PineconeDataTypeTests.cs +++ b/dotnet/test/VectorData/Pinecone.ConformanceTests/TypeTests/PineconeDataTypeTests.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft. All rights reserved. using Pinecone.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Xunit; -namespace Pinecone.ConformanceTests; +namespace Pinecone.ConformanceTests.TypeTests; public class PineconeDataTypeTests(PineconeDataTypeTests.Fixture fixture) : DataTypeTests.DefaultRecord>(fixture), IClassFixture diff --git a/dotnet/test/VectorData/Pinecone.ConformanceTests/PineconeEmbeddingTypeTests.cs b/dotnet/test/VectorData/Pinecone.ConformanceTests/TypeTests/PineconeEmbeddingTypeTests.cs similarity index 88% rename from dotnet/test/VectorData/Pinecone.ConformanceTests/PineconeEmbeddingTypeTests.cs rename to dotnet/test/VectorData/Pinecone.ConformanceTests/TypeTests/PineconeEmbeddingTypeTests.cs index 87714284439d..0dbd87534951 100644 --- a/dotnet/test/VectorData/Pinecone.ConformanceTests/PineconeEmbeddingTypeTests.cs +++ b/dotnet/test/VectorData/Pinecone.ConformanceTests/TypeTests/PineconeEmbeddingTypeTests.cs @@ -1,13 +1,13 @@ // Copyright (c) Microsoft. All rights reserved. using Pinecone.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Xunit; #pragma warning disable CA2000 // Dispose objects before losing scope -namespace Pinecone.ConformanceTests; +namespace Pinecone.ConformanceTests.TypeTests; public class PineconeEmbeddingTypeTests(PineconeEmbeddingTypeTests.Fixture fixture) : EmbeddingTypeTests(fixture), IClassFixture diff --git a/dotnet/test/VectorData/Pinecone.ConformanceTests/TypeTests/PineconeKeyTypeTests.cs b/dotnet/test/VectorData/Pinecone.ConformanceTests/TypeTests/PineconeKeyTypeTests.cs new file mode 100644 index 000000000000..6142eec22383 --- /dev/null +++ b/dotnet/test/VectorData/Pinecone.ConformanceTests/TypeTests/PineconeKeyTypeTests.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Pinecone.ConformanceTests.Support; +using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; +using VectorData.ConformanceTests.Xunit; +using Xunit; + +namespace Pinecone.ConformanceTests.TypeTests; + +public class PineconeKeyTypeTests(PineconeKeyTypeTests.Fixture fixture) + : KeyTypeTests(fixture), IClassFixture +{ + [ConditionalFact] + public virtual Task String() => this.Test("foo"); + + public new class Fixture : KeyTypeTests.Fixture + { + public override TestStore TestStore => PineconeTestStore.Instance; + + // https://docs.pinecone.io/troubleshooting/restrictions-on-index-names + public override string CollectionName => "key-type-tests"; + } +} diff --git a/dotnet/test/VectorData/Qdrant.ConformanceTests/QdrantDataTypeTests.cs b/dotnet/test/VectorData/Qdrant.ConformanceTests/TypeTests/QdrantDataTypeTests.cs similarity index 94% rename from dotnet/test/VectorData/Qdrant.ConformanceTests/QdrantDataTypeTests.cs rename to dotnet/test/VectorData/Qdrant.ConformanceTests/TypeTests/QdrantDataTypeTests.cs index e5cdb008ee82..fcecc486b8de 100644 --- a/dotnet/test/VectorData/Qdrant.ConformanceTests/QdrantDataTypeTests.cs +++ b/dotnet/test/VectorData/Qdrant.ConformanceTests/TypeTests/QdrantDataTypeTests.cs @@ -1,12 +1,12 @@ // Copyright (c) Microsoft. All rights reserved. using Qdrant.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using VectorData.ConformanceTests.Xunit; using Xunit; -namespace Qdrant.ConformanceTests; +namespace Qdrant.ConformanceTests.TypeTests; public class QdrantDataTypeTests(QdrantDataTypeTests.Fixture fixture) : DataTypeTests.DefaultRecord>(fixture), IClassFixture diff --git a/dotnet/test/VectorData/Qdrant.ConformanceTests/QdrantEmbeddingTypeTests.cs b/dotnet/test/VectorData/Qdrant.ConformanceTests/TypeTests/QdrantEmbeddingTypeTests.cs similarity index 86% rename from dotnet/test/VectorData/Qdrant.ConformanceTests/QdrantEmbeddingTypeTests.cs rename to dotnet/test/VectorData/Qdrant.ConformanceTests/TypeTests/QdrantEmbeddingTypeTests.cs index 83e75d5814d7..7229d04d8c52 100644 --- a/dotnet/test/VectorData/Qdrant.ConformanceTests/QdrantEmbeddingTypeTests.cs +++ b/dotnet/test/VectorData/Qdrant.ConformanceTests/TypeTests/QdrantEmbeddingTypeTests.cs @@ -1,13 +1,13 @@ // Copyright (c) Microsoft. All rights reserved. using Qdrant.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Xunit; #pragma warning disable CA2000 // Dispose objects before losing scope -namespace Qdrant.ConformanceTests; +namespace Qdrant.ConformanceTests.TypeTests; public class QdrantEmbeddingTypeTests(QdrantEmbeddingTypeTests.Fixture fixture) : EmbeddingTypeTests(fixture), IClassFixture diff --git a/dotnet/test/VectorData/Qdrant.ConformanceTests/TypeTests/QdrantKeyTypeTests.cs b/dotnet/test/VectorData/Qdrant.ConformanceTests/TypeTests/QdrantKeyTypeTests.cs new file mode 100644 index 000000000000..6594bddb3e35 --- /dev/null +++ b/dotnet/test/VectorData/Qdrant.ConformanceTests/TypeTests/QdrantKeyTypeTests.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Qdrant.ConformanceTests.Support; +using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; +using VectorData.ConformanceTests.Xunit; +using Xunit; + +namespace Qdrant.ConformanceTests.TypeTests; + +public class QdrantKeyTypeTests(QdrantKeyTypeTests.Fixture fixture) + : KeyTypeTests(fixture), IClassFixture +{ + [ConditionalFact] + public virtual Task ULong() => this.Test(8UL); + + public new class Fixture : KeyTypeTests.Fixture + { + public override TestStore TestStore => QdrantTestStore.NamedVectorsInstance; + } +} diff --git a/dotnet/test/VectorData/Redis.ConformanceTests/RedisHashSetDataTypeTests.cs b/dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisHashSetDataTypeTests.cs similarity index 87% rename from dotnet/test/VectorData/Redis.ConformanceTests/RedisHashSetDataTypeTests.cs rename to dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisHashSetDataTypeTests.cs index 068e3c49a120..8d61a6a688a8 100644 --- a/dotnet/test/VectorData/Redis.ConformanceTests/RedisHashSetDataTypeTests.cs +++ b/dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisHashSetDataTypeTests.cs @@ -1,12 +1,11 @@ // Copyright (c) Microsoft. All rights reserved. using Redis.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; -using VectorData.ConformanceTests.Xunit; +using VectorData.ConformanceTests.TypeTests; using Xunit; -namespace Redis.ConformanceTests; +namespace Redis.ConformanceTests.TypeTests; public class RedisHashSetDataTypeTests(RedisHashSetDataTypeTests.Fixture fixture) : DataTypeTests.DefaultRecord>(fixture), IClassFixture @@ -18,9 +17,6 @@ public class RedisHashSetDataTypeTests(RedisHashSetDataTypeTests.Fixture fixture public override Task DateOnly() => Task.CompletedTask; public override Task TimeOnly() => Task.CompletedTask; - [ConditionalFact(Skip = "Guid not yet supported")] - public override Task Guid() => Task.CompletedTask; - public override Task String_array() => this.Test( "StringArray", diff --git a/dotnet/test/VectorData/Redis.ConformanceTests/RedisHashSetEmbeddingTypeTests.cs b/dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisHashSetEmbeddingTypeTests.cs similarity index 94% rename from dotnet/test/VectorData/Redis.ConformanceTests/RedisHashSetEmbeddingTypeTests.cs rename to dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisHashSetEmbeddingTypeTests.cs index 84ddb3ad2bdf..dfbc028c0dc9 100644 --- a/dotnet/test/VectorData/Redis.ConformanceTests/RedisHashSetEmbeddingTypeTests.cs +++ b/dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisHashSetEmbeddingTypeTests.cs @@ -2,14 +2,14 @@ using Microsoft.Extensions.AI; using Redis.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using VectorData.ConformanceTests.Xunit; using Xunit; #pragma warning disable CA2000 // Dispose objects before losing scope -namespace Redis.ConformanceTests; +namespace Redis.ConformanceTests.TypeTests; public class RedisHashSetEmbeddingTypeTests(RedisHashSetEmbeddingTypeTests.Fixture fixture) : EmbeddingTypeTests(fixture), IClassFixture diff --git a/dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisHashSetKeyTypeTests.cs b/dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisHashSetKeyTypeTests.cs new file mode 100644 index 000000000000..3cd6cb1c2e63 --- /dev/null +++ b/dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisHashSetKeyTypeTests.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Extensions.VectorData; +using Redis.ConformanceTests.Support; +using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; +using VectorData.ConformanceTests.Xunit; +using Xunit; + +namespace Redis.ConformanceTests.TypeTests; + +public class RedisHashSetKeyTypeTests(RedisHashSetKeyTypeTests.Fixture fixture) + : KeyTypeTests(fixture), IClassFixture +{ + [ConditionalFact] + public virtual Task String() => this.Test("foo"); + + public new class Fixture : KeyTypeTests.Fixture + { + private int _collectionCounter; + + public override TestStore TestStore => RedisTestStore.HashSetInstance; + + // Redis doesn't seem to reliably delete the collection: when running multiple tests that delete and recreate the collection with different key types, + // we seem to get key values from the previous collection despite having deleted and recreated it. So we uniquify the collection name instead. + public override VectorStoreCollection> CreateCollection() + => this.TestStore.DefaultVectorStore.GetCollection>(this.CollectionName + (++this._collectionCounter), this.CreateRecordDefinition()); + } +} diff --git a/dotnet/test/VectorData/Redis.ConformanceTests/RedisJsonDataTypeTests.cs b/dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisJsonDataTypeTests.cs similarity index 92% rename from dotnet/test/VectorData/Redis.ConformanceTests/RedisJsonDataTypeTests.cs rename to dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisJsonDataTypeTests.cs index 426eebe2e478..4451ebbab4c8 100644 --- a/dotnet/test/VectorData/Redis.ConformanceTests/RedisJsonDataTypeTests.cs +++ b/dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisJsonDataTypeTests.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft. All rights reserved. using Redis.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Xunit; -namespace Redis.ConformanceTests; +namespace Redis.ConformanceTests.TypeTests; public class RedisJsonDataTypeTests(RedisJsonDataTypeTests.Fixture fixture) : DataTypeTests.DefaultRecord>(fixture), IClassFixture diff --git a/dotnet/test/VectorData/Redis.ConformanceTests/RedisJsonEmbeddingTypeTests.cs b/dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisJsonEmbeddingTypeTests.cs similarity index 94% rename from dotnet/test/VectorData/Redis.ConformanceTests/RedisJsonEmbeddingTypeTests.cs rename to dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisJsonEmbeddingTypeTests.cs index 18bcfd24c36a..090b94c8e88c 100644 --- a/dotnet/test/VectorData/Redis.ConformanceTests/RedisJsonEmbeddingTypeTests.cs +++ b/dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisJsonEmbeddingTypeTests.cs @@ -2,14 +2,14 @@ using Microsoft.Extensions.AI; using Redis.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using VectorData.ConformanceTests.Xunit; using Xunit; #pragma warning disable CA2000 // Dispose objects before losing scope -namespace Redis.ConformanceTests; +namespace Redis.ConformanceTests.TypeTests; public class RedisJsonEmbeddingTypeTests(RedisJsonEmbeddingTypeTests.Fixture fixture) : EmbeddingTypeTests(fixture), IClassFixture diff --git a/dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisJsonKeyTypeTests.cs b/dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisJsonKeyTypeTests.cs new file mode 100644 index 000000000000..ddcbbaa77de4 --- /dev/null +++ b/dotnet/test/VectorData/Redis.ConformanceTests/TypeTests/RedisJsonKeyTypeTests.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Extensions.VectorData; +using Redis.ConformanceTests.Support; +using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; +using VectorData.ConformanceTests.Xunit; +using Xunit; + +namespace Redis.ConformanceTests.TypeTests; + +public class RedisJsonKeyTypeTests(RedisJsonKeyTypeTests.Fixture fixture) + : KeyTypeTests(fixture), IClassFixture +{ + [ConditionalFact] + public virtual Task String() => this.Test("foo"); + + public new class Fixture : KeyTypeTests.Fixture + { + private int _collectionCounter; + + public override TestStore TestStore => RedisTestStore.JsonInstance; + + // Redis doesn't seem to reliably delete the collection: when running multiple tests that delete and recreate the collection with different key types, + // we seem to get key values from the previous collection despite having deleted and recreated it. So we uniquify the collection name instead. + public override VectorStoreCollection> CreateCollection() + => this.TestStore.DefaultVectorStore.GetCollection>(this.CollectionName + (++this._collectionCounter), this.CreateRecordDefinition()); + } +} diff --git a/dotnet/test/VectorData/SqlServer.ConformanceTests/SqlServerDataTypeTests.cs b/dotnet/test/VectorData/SqlServer.ConformanceTests/TypeTests/SqlServerDataTypeTests.cs similarity index 89% rename from dotnet/test/VectorData/SqlServer.ConformanceTests/SqlServerDataTypeTests.cs rename to dotnet/test/VectorData/SqlServer.ConformanceTests/TypeTests/SqlServerDataTypeTests.cs index 15e39e630ddf..db4f80ac976b 100644 --- a/dotnet/test/VectorData/SqlServer.ConformanceTests/SqlServerDataTypeTests.cs +++ b/dotnet/test/VectorData/SqlServer.ConformanceTests/TypeTests/SqlServerDataTypeTests.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft. All rights reserved. using SqlServer.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Xunit; -namespace SqlServer.ConformanceTests; +namespace SqlServer.ConformanceTests.TypeTests; public class SqlServerDataTypeTests(SqlServerDataTypeTests.Fixture fixture) : DataTypeTests.DefaultRecord>(fixture), IClassFixture diff --git a/dotnet/test/VectorData/SqlServer.ConformanceTests/SqlServerEmbeddingTypeTests.cs b/dotnet/test/VectorData/SqlServer.ConformanceTests/TypeTests/SqlServerEmbeddingTypeTests.cs similarity index 91% rename from dotnet/test/VectorData/SqlServer.ConformanceTests/SqlServerEmbeddingTypeTests.cs rename to dotnet/test/VectorData/SqlServer.ConformanceTests/TypeTests/SqlServerEmbeddingTypeTests.cs index 17b858aec8e7..4a939691da9d 100644 --- a/dotnet/test/VectorData/SqlServer.ConformanceTests/SqlServerEmbeddingTypeTests.cs +++ b/dotnet/test/VectorData/SqlServer.ConformanceTests/TypeTests/SqlServerEmbeddingTypeTests.cs @@ -2,14 +2,14 @@ using Microsoft.Data.SqlTypes; using SqlServer.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using VectorData.ConformanceTests.Xunit; using Xunit; #pragma warning disable CA2000 // Dispose objects before losing scope -namespace SqlServer.ConformanceTests; +namespace SqlServer.ConformanceTests.TypeTests; public class SqlServerEmbeddingTypeTests(SqlServerEmbeddingTypeTests.Fixture fixture) : EmbeddingTypeTests(fixture), IClassFixture diff --git a/dotnet/test/VectorData/SqlServer.ConformanceTests/TypeTests/SqlServerKeyTypeTests.cs b/dotnet/test/VectorData/SqlServer.ConformanceTests/TypeTests/SqlServerKeyTypeTests.cs new file mode 100644 index 000000000000..8165c046fec5 --- /dev/null +++ b/dotnet/test/VectorData/SqlServer.ConformanceTests/TypeTests/SqlServerKeyTypeTests.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft. All rights reserved. + +using SqlServer.ConformanceTests.Support; +using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; +using VectorData.ConformanceTests.Xunit; +using Xunit; + +namespace SqlServer.ConformanceTests.TypeTests; + +public class SqlServerKeyTypeTests(SqlServerKeyTypeTests.Fixture fixture) + : KeyTypeTests(fixture), IClassFixture +{ + [ConditionalFact] + public virtual Task Int() => this.Test(8); + + [ConditionalFact] + public virtual Task Long() => this.Test(8L); + + [ConditionalFact] + public virtual Task String() => this.Test("foo"); + + public new class Fixture : KeyTypeTests.Fixture + { + public override TestStore TestStore => SqlServerTestStore.Instance; + } +} diff --git a/dotnet/test/VectorData/SqliteVec.ConformanceTests/SqliteFilterTests.cs b/dotnet/test/VectorData/SqliteVec.ConformanceTests/SqliteFilterTests.cs index d981a2a12998..139217580bca 100644 --- a/dotnet/test/VectorData/SqliteVec.ConformanceTests/SqliteFilterTests.cs +++ b/dotnet/test/VectorData/SqliteVec.ConformanceTests/SqliteFilterTests.cs @@ -18,7 +18,7 @@ public override async Task Not_over_Or() { // Test sends: WHERE (NOT (("Int" = 8) OR ("String" = 'foo'))) // There's a NULL string in the database, and relational null semantics in conjunction with negation makes the default implementation fail. - await Assert.ThrowsAsync(() => base.Not_over_Or()); + await Assert.ThrowsAsync(base.Not_over_Or); // Compensate by adding a null check: await this.TestFilterAsync( @@ -29,7 +29,7 @@ await this.TestFilterAsync( public override async Task NotEqual_with_string() { // As above, null semantics + negation - await Assert.ThrowsAsync(() => base.NotEqual_with_string()); + await Assert.ThrowsAsync(base.NotEqual_with_string); await this.TestFilterAsync( r => r.String != null && r.String != "foo", @@ -38,30 +38,35 @@ await this.TestFilterAsync( // Array fields not (currently) supported on SQLite (see #10343) public override Task Contains_over_field_string_array() - => Assert.ThrowsAsync(() => base.Contains_over_field_string_array()); + => Assert.ThrowsAsync(base.Contains_over_field_string_array); // List fields not (currently) supported on SQLite (see #10343) public override Task Contains_over_field_string_List() - => Assert.ThrowsAsync(() => base.Contains_over_field_string_List()); + => Assert.ThrowsAsync(base.Contains_over_field_string_List); // List fields not (currently) supported on SQLite (see #10343) public override Task Contains_with_Enumerable_Contains() - => Assert.ThrowsAsync(() => base.Contains_with_Enumerable_Contains()); + => Assert.ThrowsAsync(base.Contains_with_Enumerable_Contains); #if !NETFRAMEWORK // List fields not (currently) supported on SQLite (see #10343) public override Task Contains_with_MemoryExtensions_Contains() - => Assert.ThrowsAsync(() => base.Contains_with_MemoryExtensions_Contains()); + => Assert.ThrowsAsync(base.Contains_with_MemoryExtensions_Contains); +#endif + +#if NET10_0_OR_GREATER + public override Task Contains_with_MemoryExtensions_Contains_with_null_comparer() + => Assert.ThrowsAsync(base.Contains_with_MemoryExtensions_Contains_with_null_comparer); #endif // AnyTagEqualTo not (currently) supported on SQLite [Obsolete("Legacy filter support")] public override Task Legacy_AnyTagEqualTo_array() - => Assert.ThrowsAsync(() => base.Legacy_AnyTagEqualTo_array()); + => Assert.ThrowsAsync(base.Legacy_AnyTagEqualTo_array); [Obsolete("Legacy filter support")] public override Task Legacy_AnyTagEqualTo_List() - => Assert.ThrowsAsync(() => base.Legacy_AnyTagEqualTo_List()); + => Assert.ThrowsAsync(base.Legacy_AnyTagEqualTo_List); public new class Fixture : FilterTests.Fixture { diff --git a/dotnet/test/VectorData/SqliteVec.ConformanceTests/SqliteDataTypeTests.cs b/dotnet/test/VectorData/SqliteVec.ConformanceTests/TypeTests/SqliteDataTypeTests.cs similarity index 89% rename from dotnet/test/VectorData/SqliteVec.ConformanceTests/SqliteDataTypeTests.cs rename to dotnet/test/VectorData/SqliteVec.ConformanceTests/TypeTests/SqliteDataTypeTests.cs index e4c73b7e509f..65223367d780 100644 --- a/dotnet/test/VectorData/SqliteVec.ConformanceTests/SqliteDataTypeTests.cs +++ b/dotnet/test/VectorData/SqliteVec.ConformanceTests/TypeTests/SqliteDataTypeTests.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft. All rights reserved. using SqliteVec.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Xunit; -namespace SqliteVec.ConformanceTests; +namespace SqliteVec.ConformanceTests.TypeTests; public class SqliteDataTypeTests(SqliteDataTypeTests.Fixture fixture) : DataTypeTests.DefaultRecord>(fixture), IClassFixture @@ -18,7 +18,6 @@ public class SqliteDataTypeTests(SqliteDataTypeTests.Fixture fixture) [ typeof(byte), typeof(decimal), - typeof(Guid), typeof(DateTime), typeof(DateTimeOffset), typeof(string[]), diff --git a/dotnet/test/VectorData/SqliteVec.ConformanceTests/SqliteEmbeddingTypeTests.cs b/dotnet/test/VectorData/SqliteVec.ConformanceTests/TypeTests/SqliteEmbeddingTypeTests.cs similarity index 92% rename from dotnet/test/VectorData/SqliteVec.ConformanceTests/SqliteEmbeddingTypeTests.cs rename to dotnet/test/VectorData/SqliteVec.ConformanceTests/TypeTests/SqliteEmbeddingTypeTests.cs index a06d57b320cc..0b783d312a3d 100644 --- a/dotnet/test/VectorData/SqliteVec.ConformanceTests/SqliteEmbeddingTypeTests.cs +++ b/dotnet/test/VectorData/SqliteVec.ConformanceTests/TypeTests/SqliteEmbeddingTypeTests.cs @@ -1,8 +1,8 @@ // Copyright (c) Microsoft. All rights reserved. using SqliteVec.ConformanceTests.Support; -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Xunit; #pragma warning disable CA2000 // Dispose objects before losing scope diff --git a/dotnet/test/VectorData/SqliteVec.ConformanceTests/TypeTests/SqliteKeyTypeTests.cs b/dotnet/test/VectorData/SqliteVec.ConformanceTests/TypeTests/SqliteKeyTypeTests.cs new file mode 100644 index 000000000000..0e5134a12d78 --- /dev/null +++ b/dotnet/test/VectorData/SqliteVec.ConformanceTests/TypeTests/SqliteKeyTypeTests.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft. All rights reserved. + +using SqliteVec.ConformanceTests.Support; +using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; +using VectorData.ConformanceTests.Xunit; +using Xunit; + +namespace SqliteVec.ConformanceTests.TypeTests; + +public class SqliteKeyTypeTests(SqliteKeyTypeTests.Fixture fixture) + : KeyTypeTests(fixture), IClassFixture +{ + [ConditionalFact] + public virtual Task Int() => this.Test(8); + + [ConditionalFact] + public virtual Task Long() => this.Test(8L); + + [ConditionalFact] + public virtual Task String() => this.Test("foo"); + + public new class Fixture : KeyTypeTests.Fixture + { + public override TestStore TestStore => SqliteTestStore.Instance; + } +} diff --git a/dotnet/test/VectorData/VectorData.ConformanceTests/DataTypeTests.cs b/dotnet/test/VectorData/VectorData.ConformanceTests/TypeTests/DataTypeTests.cs similarity index 99% rename from dotnet/test/VectorData/VectorData.ConformanceTests/DataTypeTests.cs rename to dotnet/test/VectorData/VectorData.ConformanceTests/TypeTests/DataTypeTests.cs index e693f492f137..099f507d6b5e 100644 --- a/dotnet/test/VectorData/VectorData.ConformanceTests/DataTypeTests.cs +++ b/dotnet/test/VectorData/VectorData.ConformanceTests/TypeTests/DataTypeTests.cs @@ -7,11 +7,8 @@ using VectorData.ConformanceTests.Xunit; using Xunit; -namespace VectorData.ConformanceTests; +namespace VectorData.ConformanceTests.TypeTests; -/// -/// Tests that the various embedding types natively supported by the provider (ReadOnlyMemory<float>, ReadOnlyMemory<Half>...) work correctly. -/// public abstract class DataTypeTests(DataTypeTests.Fixture fixture) : DataTypeTests() where TKey : notnull where TRecord : DataTypeTests.RecordBase, new() diff --git a/dotnet/test/VectorData/VectorData.ConformanceTests/EmbeddingTypeTests.cs b/dotnet/test/VectorData/VectorData.ConformanceTests/TypeTests/EmbeddingTypeTests.cs similarity index 99% rename from dotnet/test/VectorData/VectorData.ConformanceTests/EmbeddingTypeTests.cs rename to dotnet/test/VectorData/VectorData.ConformanceTests/TypeTests/EmbeddingTypeTests.cs index c73dc7737483..f5521e831caf 100644 --- a/dotnet/test/VectorData/VectorData.ConformanceTests/EmbeddingTypeTests.cs +++ b/dotnet/test/VectorData/VectorData.ConformanceTests/TypeTests/EmbeddingTypeTests.cs @@ -9,7 +9,7 @@ #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable. #pragma warning disable CA2000 // Dispose objects before losing scope -namespace VectorData.ConformanceTests; +namespace VectorData.ConformanceTests.TypeTests; /// /// Tests that the various embedding types natively supported by the provider (ReadOnlyMemory<float>, ReadOnlyMemory<Half>...) work correctly. diff --git a/dotnet/test/VectorData/VectorData.ConformanceTests/TypeTests/KeyTypeTests.cs b/dotnet/test/VectorData/VectorData.ConformanceTests/TypeTests/KeyTypeTests.cs new file mode 100644 index 000000000000..346a3b3ecc2a --- /dev/null +++ b/dotnet/test/VectorData/VectorData.ConformanceTests/TypeTests/KeyTypeTests.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Extensions.VectorData; +using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.Xunit; +using Xunit; + +namespace VectorData.ConformanceTests.TypeTests; + +public abstract class KeyTypeTests(KeyTypeTests.Fixture fixture) +{ + // All MEVD providers are expected to support Guid keys (possibly by storing them as strings). + // This allows upper layers such as Microsoft.Extensions.DataIngestion to use Guid keys consistently. + [ConditionalFact] + public virtual Task Guid() => this.Test(new Guid("603840bf-cf91-4521-8b8e-8b6a2e75910a")); + + protected virtual async Task Test(TKey mainValue) + where TKey : notnull + { + using var collection = fixture.CreateCollection(); + + await collection.EnsureCollectionDeletedAsync(); + await collection.EnsureCollectionExistsAsync(); + + var record = new Record + { + Key = mainValue, + Int = 8, + Vector = new ReadOnlyMemory([1, 2, 3]) + }; + + await collection.UpsertAsync(record); + await fixture.TestStore.WaitForDataAsync(collection, recordCount: 1); + + var result = await collection.GetAsync(mainValue); + + Assert.NotNull(result); + Assert.Equal(8, result.Int); + } + + public abstract class Fixture : VectorStoreFixture + { + public virtual string CollectionName => "KeyTypeTests"; + + public virtual VectorStoreCollection> CreateCollection() + where TKey : notnull + => this.TestStore.DefaultVectorStore.GetCollection>(this.CollectionName, this.CreateRecordDefinition()); + + public virtual VectorStoreCollectionDefinition CreateRecordDefinition() + where TKey : notnull + => new() + { + Properties = + [ + new VectorStoreKeyProperty("Key", typeof(TKey)), + new VectorStoreDataProperty("Int", typeof(int)), + new VectorStoreVectorProperty("Vector", typeof(ReadOnlyMemory), dimensions: 3) + { + DistanceFunction = this.DefaultDistanceFunction, + IndexKind = this.DefaultIndexKind + } + ] + }; + } + + public class Record + { + public TKey Key { get; set; } = default!; + public int Int { get; set; } + public ReadOnlyMemory Vector { get; set; } + } +} diff --git a/dotnet/test/VectorData/Weaviate.ConformanceTests/WeaviateDataTypeTests.cs b/dotnet/test/VectorData/Weaviate.ConformanceTests/TypeTests/WeaviateDataTypeTests.cs similarity index 92% rename from dotnet/test/VectorData/Weaviate.ConformanceTests/WeaviateDataTypeTests.cs rename to dotnet/test/VectorData/Weaviate.ConformanceTests/TypeTests/WeaviateDataTypeTests.cs index 9a258fa2d472..1306004e1461 100644 --- a/dotnet/test/VectorData/Weaviate.ConformanceTests/WeaviateDataTypeTests.cs +++ b/dotnet/test/VectorData/Weaviate.ConformanceTests/TypeTests/WeaviateDataTypeTests.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft. All rights reserved. -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Weaviate.ConformanceTests.Support; using Xunit; -namespace Weaviate.ConformanceTests; +namespace Weaviate.ConformanceTests.TypeTests; public class WeaviateDataTypeTests(WeaviateDataTypeTests.Fixture fixture) : DataTypeTests.DefaultRecord>(fixture), IClassFixture diff --git a/dotnet/test/VectorData/Weaviate.ConformanceTests/WeaviateEmbeddingTypeTests.cs b/dotnet/test/VectorData/Weaviate.ConformanceTests/TypeTests/WeaviateEmbeddingTypeTests.cs similarity index 85% rename from dotnet/test/VectorData/Weaviate.ConformanceTests/WeaviateEmbeddingTypeTests.cs rename to dotnet/test/VectorData/Weaviate.ConformanceTests/TypeTests/WeaviateEmbeddingTypeTests.cs index 8cb41d47dadf..ac24a2e3ca63 100644 --- a/dotnet/test/VectorData/Weaviate.ConformanceTests/WeaviateEmbeddingTypeTests.cs +++ b/dotnet/test/VectorData/Weaviate.ConformanceTests/TypeTests/WeaviateEmbeddingTypeTests.cs @@ -1,13 +1,13 @@ // Copyright (c) Microsoft. All rights reserved. -using VectorData.ConformanceTests; using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; using Weaviate.ConformanceTests.Support; using Xunit; #pragma warning disable CA2000 // Dispose objects before losing scope -namespace Weaviate.ConformanceTests; +namespace Weaviate.ConformanceTests.TypeTests; public class WeaviateEmbeddingTypeTests(WeaviateEmbeddingTypeTests.Fixture fixture) : EmbeddingTypeTests(fixture), IClassFixture diff --git a/dotnet/test/VectorData/Weaviate.ConformanceTests/TypeTests/WeaviateKeyTypeTests.cs b/dotnet/test/VectorData/Weaviate.ConformanceTests/TypeTests/WeaviateKeyTypeTests.cs new file mode 100644 index 000000000000..dfbea528237d --- /dev/null +++ b/dotnet/test/VectorData/Weaviate.ConformanceTests/TypeTests/WeaviateKeyTypeTests.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft. All rights reserved. + +using VectorData.ConformanceTests.Support; +using VectorData.ConformanceTests.TypeTests; +using Weaviate.ConformanceTests.Support; +using Xunit; + +namespace Weaviate.ConformanceTests.TypeTests; + +public class WeaviateKeyTypeTests(WeaviateKeyTypeTests.Fixture fixture) + : KeyTypeTests(fixture), IClassFixture +{ + public new class Fixture : KeyTypeTests.Fixture + { + public override TestStore TestStore => WeaviateTestStore.NamedVectorsInstance; + } +}