-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGlobalMessagePipeMinimalBootstrapEditModeTests.cs
More file actions
47 lines (43 loc) · 1.88 KB
/
GlobalMessagePipeMinimalBootstrapEditModeTests.cs
File metadata and controls
47 lines (43 loc) · 1.88 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
47
using CoreAI.Composition;
using CoreAI.Messaging;
using MessagePipe;
using NUnit.Framework;
namespace CoreAI.Tests.EditMode
{
/// <summary>
/// <see cref="GlobalMessagePipeMinimalBootstrap"/> must wire the same broker types that
/// <c>ToolExecutionPolicy</c> publishes when <see cref="GlobalMessagePipe"/> had no provider yet
/// (package PlayMode <c>TestAgentSetup</c> and other minimal fixtures).
/// </summary>
public sealed class GlobalMessagePipeMinimalBootstrapEditModeTests
{
[Test]
public void EnsureInitializedForLlmDiagnostics_IsIdempotent_And_DeliversLlmToolCallCompleted()
{
GlobalMessagePipeMinimalBootstrap.EnsureInitializedForLlmDiagnostics();
Assert.That(GlobalMessagePipe.IsInitialized, Is.True, "First Ensure should set GlobalMessagePipe.");
GlobalMessagePipeMinimalBootstrap.EnsureInitializedForLlmDiagnostics();
Assert.That(GlobalMessagePipe.IsInitialized, Is.True, "Second Ensure must not throw and keep provider.");
int received = 0;
LlmToolCallCompleted last = default;
using (GlobalMessagePipe.GetSubscriber<LlmToolCallCompleted>().Subscribe(evt =>
{
received++;
last = evt;
}))
{
GlobalMessagePipe.GetPublisher<LlmToolCallCompleted>().Publish(
new LlmToolCallCompleted(
"editmode-bootstrap",
"Creator",
"memory",
"{\"action\":\"write\"}",
"{\"ok\":true}",
1d));
Assert.That(received, Is.EqualTo(1));
Assert.That(last.ToolName, Is.EqualTo("memory"));
Assert.That(last.RoleId, Is.EqualTo("Creator"));
}
}
}
}