forked from managedcode/CodexSharpSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodexServiceCollectionExtensionsTests.cs
More file actions
39 lines (35 loc) · 1.34 KB
/
CodexServiceCollectionExtensionsTests.cs
File metadata and controls
39 lines (35 loc) · 1.34 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
29
30
31
32
33
34
35
36
37
38
39
using ManagedCode.CodexSharpSDK.Extensions.AI.Extensions;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.DependencyInjection;
namespace ManagedCode.CodexSharpSDK.Extensions.AI.Tests;
public class CodexServiceCollectionExtensionsTests
{
[Test]
public async Task AddCodexChatClient_RegistersIChatClient()
{
var services = new ServiceCollection();
services.AddCodexChatClient();
var provider = services.BuildServiceProvider();
var client = provider.GetService<IChatClient>();
await Assert.That(client).IsNotNull();
await Assert.That(client).IsTypeOf<CodexChatClient>();
}
[Test]
public async Task AddCodexChatClient_WithConfiguration_RegistersIChatClient()
{
var services = new ServiceCollection();
services.AddCodexChatClient(_ => { });
var provider = services.BuildServiceProvider();
var client = provider.GetService<IChatClient>();
await Assert.That(client).IsNotNull();
}
[Test]
public async Task AddKeyedCodexChatClient_RegistersWithKey()
{
var services = new ServiceCollection();
services.AddKeyedCodexChatClient("codex");
var provider = services.BuildServiceProvider();
var client = provider.GetKeyedService<IChatClient>("codex");
await Assert.That(client).IsNotNull();
}
}