// Copyright (c) Microsoft. All rights reserved. using System; using Microsoft.Extensions.VectorData; using Microsoft.SemanticKernel.Connectors.Pinecone; using Pinecone; using Xunit; namespace SemanticKernel.Connectors.Pinecone.UnitTests; /// /// Contains tests for the class. /// public class PineconeCollectionTests { private const string TestCollectionName = "testcollection"; /// /// Tests that the collection can be created even if the definition and the type do not match. /// In this case, the expectation is that a custom mapper will be provided to map between the /// schema as defined by the definition and the different data model. /// [Fact] public void CanCreateCollectionWithMismatchedDefinitionAndType() { // Arrange. var definition = new VectorStoreCollectionDefinition() { Properties = [ new VectorStoreKeyProperty("Key", typeof(string)), new VectorStoreDataProperty("OriginalNameData", typeof(string)), new VectorStoreVectorProperty("Vector", typeof(ReadOnlyMemory?), 4), ] }; var pineconeClient = new PineconeClient("fake api key"); // Act. using var sut = new PineconeCollection( pineconeClient, TestCollectionName, new() { Definition = definition }); } public sealed class SinglePropsModel { public string Key { get; set; } = string.Empty; public string OriginalNameData { get; set; } = string.Empty; public string Data { get; set; } = string.Empty; public ReadOnlyMemory? Vector { get; set; } } }