Add ScriptedRealtimeUpstream + FakeDeviceChannel test doubles

This commit is contained in:
2026-06-11 21:27:50 +00:00
parent 35a6e8febb
commit 8f197d1203
2 changed files with 71 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
using System.Collections.Concurrent;
using System.Text.Json;
using backend.Tools;
namespace backend.tests;
// Slim version for Tasks 9-15. Task 16 reopens this file to add IDeviceClient + envelope sending.
public class FakeDeviceChannel : IDeviceChannel
{
public ConcurrentQueue<JsonElement> PiToolReplies { get; } = new();
public Task<JsonElement> CallPiToolAsync(string name, JsonElement args, CancellationToken ct)
{
if (PiToolReplies.TryDequeue(out var reply))
return Task.FromResult(reply);
return Task.FromResult(JsonDocument.Parse("""{"ok":true}""").RootElement);
}
}