-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathPgVectorConnectorTests.cs
More file actions
28 lines (24 loc) · 1.19 KB
/
PgVectorConnectorTests.cs
File metadata and controls
28 lines (24 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using EssentialCSharp.Chat.Common.Models;
using Microsoft.SemanticKernel.Connectors.PgVector;
namespace EssentialCSharp.Chat.Tests;
public class PgVectorConnectorTests
{
/// <summary>
/// Verifies that PostgresVectorStore.GetCollection does not throw a TypeLoadException,
/// which would indicate a version mismatch between Microsoft.SemanticKernel core and
/// Microsoft.SemanticKernel.Connectors.PgVector (e.g., missing vtable slots on
/// internal types like PostgresModelBuilder).
/// </summary>
[Test]
public async Task GetCollection_WithBookContentChunk_DoesNotThrowTypeLoadException()
{
// Arrange — no real DB connection is needed; connections are only opened for actual queries
#pragma warning disable SKEXP0010 // PostgresVectorStore is experimental
using var store = new PostgresVectorStore("Host=localhost;Database=test;Username=test;Password=test");
// Act — this triggers loading internal PostgresModelBuilder via PostgresCollection ctor
var collection = store.GetCollection<string, BookContentChunk>("test-collection");
#pragma warning restore SKEXP0010
// Assert
await Assert.That(collection).IsNotNull();
}
}