-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCodexFeatureKeysTests.cs
More file actions
46 lines (40 loc) · 1.36 KB
/
CodexFeatureKeysTests.cs
File metadata and controls
46 lines (40 loc) · 1.36 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
40
41
42
43
44
45
46
using System.Reflection;
using ManagedCode.CodexSharpSDK.Models;
namespace ManagedCode.CodexSharpSDK.Tests.Unit;
public class CodexFeatureKeysTests
{
[Test]
public async Task ToolCallMcpElicitation_HasCorrectValue()
{
var key = CodexFeatureKeys.ToolCallMcpElicitation;
await Assert.That(key).IsEqualTo("tool_call_mcp_elicitation");
}
[Test]
public async Task AllFeatureKeys_AreNonEmptyStrings()
{
var keys = GetAllFeatureKeyValues();
foreach (var key in keys)
{
await Assert.That(string.IsNullOrWhiteSpace(key)).IsFalse();
}
}
[Test]
public async Task AllFeatureKeys_AreUnique()
{
var keys = GetAllFeatureKeyValues();
var duplicates = keys
.GroupBy(k => k, StringComparer.Ordinal)
.Where(g => g.Count() > 1)
.Select(g => g.Key)
.ToArray();
await Assert.That(duplicates).IsEmpty();
}
private static string[] GetAllFeatureKeyValues()
{
return typeof(CodexFeatureKeys)
.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly)
.Where(field => field is { IsLiteral: true, IsInitOnly: false, FieldType: not null } && field.FieldType == typeof(string))
.Select(field => (string)field.GetRawConstantValue()!)
.ToArray();
}
}