Blocking findings: 1. A Codex RPC error or early exit threw past LimitProbe and stopped the refresh loop, so Claude stopped updating too (D2). Every probe failure is now a failed probe result, the loop records an unexpected tick failure and keeps ticking, shutdown cancellation still propagates, the app reports failed operations, and the CLI exits 1 instead of crashing. Fake app-server modes in the GUI process host test errors, EOF and garbage. 2. Totals converted local midnight directly and threw where midnight does not exist (Cairo, Santiago, Beirut). Today and the week start through CalendarDays now. 3. Daily chart labels used UTC dates for local-day buckets; labels and tooltips now share the local date. Review notes fixed as well: Claude Code installed with npm on Windows is found through its native binary or cli.js; the plugin ends cleanly on a bad host frame; Linux autostart honours XDG_CONFIG_HOME; the unused stub installer and the worker names in docs are gone. Refs #1
This commit is contained in:
@@ -2,6 +2,6 @@
|
||||
Hand-written fixtures only. xUnit v3 AOT with Microsoft.Testing.Platform.
|
||||
Run `dotnet test --project tests/FinalToken.App.Tests -c Release` from the root.
|
||||
View-model tests use public Core queries. Headless tests run on a dedicated UI thread with
|
||||
Skia and HarfBuzz, exercise settings and popup actions, and save seven PNG screenshots outside
|
||||
the repo at ../runs/shots/w2. FINALTOKEN_SCREENSHOT_DIR overrides that path.
|
||||
Skia and HarfBuzz, exercise settings and popup actions, and save PNG screenshots outside
|
||||
the repo at ../runs/shots/app. FINALTOKEN_SCREENSHOT_DIR overrides that path.
|
||||
Popup expiry uses an injected TimeProvider; fire timers and pump the dispatcher instead of sleeping.
|
||||
|
||||
@@ -5,6 +5,24 @@ namespace FinalToken.App.Tests;
|
||||
|
||||
public sealed class FormattingTests
|
||||
{
|
||||
[Fact]
|
||||
public void DailyChartLabelAndTooltipUseTheBucketsLocalDate()
|
||||
{
|
||||
var zone = TimeZoneInfo.CreateCustomTimeZone("Fixture+02", TimeSpan.FromHours(2), "Fixture", "Fixture");
|
||||
var day = FinalToken.Core.CalendarDays.Start(new DateTimeOffset(2026, 10, 14, 12, 0, 0, TimeSpan.Zero), zone);
|
||||
Assert.Equal("10-14", Display.ChartDateLabel(day, TimeSpan.FromDays(1)));
|
||||
Assert.Equal(day.DateTime.ToString("g"), Display.ChartTimestamp(day, TimeSpan.FromDays(1)));
|
||||
}
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
[InlineData("custom-config")]
|
||||
public void LinuxAutostartHonorsConfigHome(string? configHome)
|
||||
{
|
||||
var home = Path.Combine(Path.GetTempPath(), "fixture-home");
|
||||
var config = string.IsNullOrEmpty(configHome) ? null : Path.Combine(Path.GetTempPath(), configHome);
|
||||
Assert.Equal(Path.Combine(config ?? Path.Combine(home, ".config"), "autostart", "finaltoken.desktop"), OsStartup.LinuxAutostartPath(config, home));
|
||||
}
|
||||
[Theory]
|
||||
[InlineData("de-DE")]
|
||||
[InlineData("en-US")]
|
||||
|
||||
@@ -26,7 +26,7 @@ public sealed class HeadlessTests
|
||||
AppBuilder.Configure<TestApplication>().UseSkia().UseHarfBuzz().UseHeadless(new() { UseHeadlessDrawing = false }).SetupWithoutStarting();
|
||||
var root = new DirectoryInfo(AppContext.BaseDirectory);
|
||||
while (root.Parent is not null && !File.Exists(Path.Combine(root.FullName, "FinalToken.slnx"))) root = root.Parent;
|
||||
var shots = Environment.GetEnvironmentVariable("FINALTOKEN_SCREENSHOT_DIR") ?? Path.Combine(root.Parent!.FullName, "runs", "shots", "w2");
|
||||
var shots = Environment.GetEnvironmentVariable("FINALTOKEN_SCREENSHOT_DIR") ?? Path.Combine(root.Parent!.FullName, "runs", "shots", "app");
|
||||
Directory.CreateDirectory(shots);
|
||||
var model = FakeData.Model();
|
||||
var panel = new PanelWindow(model, () => { }, () => { }, () => { }, () => { }) { Height = 2450 };
|
||||
@@ -86,7 +86,7 @@ public sealed class HeadlessTests
|
||||
using (chartWindow.CaptureRenderedFrame()) { }
|
||||
chartWindow.MouseMove(new Point(65, 80));
|
||||
Assert.Contains(123456.ToString("N0"), ToolTip.GetTip(chart)?.ToString()); chartWindow.Close();
|
||||
var polishShots = Path.Combine(root.Parent!.FullName, "runs", "shots", "w1");
|
||||
var polishShots = shots;
|
||||
Directory.CreateDirectory(polishShots);
|
||||
var emptyChart = new Window { Content = Ui.Card(Ui.Stack(Ui.Text("Tokens per hour", 19), new UsageChart())), Width = 620, Height = 260,
|
||||
RequestedThemeVariant = ThemeVariant.Light };
|
||||
@@ -96,6 +96,13 @@ public sealed class HeadlessTests
|
||||
{ Values = [new(time, "Claude", 1), new(time.AddHours(1), "Claude", 2), new(time.AddHours(2), "Claude", 3)] })),
|
||||
Width = 620, Height = 260, RequestedThemeVariant = ThemeVariant.Light };
|
||||
smallChart.Show(); Save(smallChart, "chart-max-3.png", polishShots); smallChart.Close();
|
||||
var day = new DateTimeOffset(2026, 10, 14, 0, 0, 0, TimeSpan.FromHours(2));
|
||||
var daily = new UsageChart { Interval = TimeSpan.FromDays(1), Values = [new(day, "Claude", 3), new(day.AddDays(1), "Claude", 2)] };
|
||||
var dailyWindow = new Window { Content = Ui.Card(Ui.Stack(Ui.Text("Tokens per day", 19), daily)),
|
||||
Width = 620, Height = 260, RequestedThemeVariant = ThemeVariant.Light };
|
||||
dailyWindow.Show(); Save(dailyWindow, "chart-local-day.png");
|
||||
dailyWindow.MouseMove(new Point(90, 150));
|
||||
Assert.Contains(day.DateTime.ToString("g"), ToolTip.GetTip(daily)?.ToString()); dailyWindow.Close();
|
||||
popupClock.Fire(); Dispatcher.UIThread.RunJobs();
|
||||
Assert.False(first.IsVisible); Assert.False(second.IsVisible);
|
||||
Assert.All(popupClock.Timers, timer => Assert.True(timer.Disposed));
|
||||
|
||||
@@ -6,6 +6,19 @@ namespace FinalToken.Cli.Tests;
|
||||
|
||||
public class CliTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task UnexpectedRefreshFailureReturnsOneWithoutExceptionText()
|
||||
{
|
||||
var directory = Path.Combine(Path.GetTempPath(), "finaltoken-cli-" + Guid.NewGuid().ToString("N"));
|
||||
try
|
||||
{
|
||||
using var output = new StringWriter(); using var error = new StringWriter();
|
||||
Assert.Equal(1, await CliApplication.RunAsync(["status"], output, error, directory,
|
||||
_ => throw new System.Text.Json.JsonException("synthetic private input"), TestContext.Current.CancellationToken));
|
||||
Assert.Contains("could not complete", error.ToString()); Assert.DoesNotContain("synthetic private", error.ToString());
|
||||
}
|
||||
finally { if (Directory.Exists(directory)) Directory.Delete(directory, true); }
|
||||
}
|
||||
[Theory]
|
||||
[InlineData("")]
|
||||
[InlineData("unknown")]
|
||||
|
||||
@@ -6,6 +6,22 @@ namespace FinalToken.Core.Tests;
|
||||
|
||||
public class DiscoveryAndPolicyTests
|
||||
{
|
||||
[Fact]
|
||||
public void WindowsClaudeNpmShimResolvesInstalledNativeBinary()
|
||||
{
|
||||
using var directory = new TestDirectory(); directory.Write("claude.cmd", "fixture");
|
||||
var binary = directory.Write("node_modules/@anthropic-ai/claude-code/bin/claude.exe", "fixture native");
|
||||
Assert.Equal(binary, CliDiscovery.Find(Provider.Claude, searchPath: directory.Path, windows: true).Command?.FileName);
|
||||
}
|
||||
[Fact]
|
||||
public void WindowsClaudeNpmShimFallsBackToLegacyCliScriptWithoutShell()
|
||||
{
|
||||
using var directory = new TestDirectory(); directory.Write("claude.cmd", "fixture");
|
||||
var script = directory.Write("node_modules/@anthropic-ai/claude-code/cli.js", "fixture script");
|
||||
var node = directory.Write("node.exe", "fixture node");
|
||||
var command = CliDiscovery.Find(Provider.Claude, searchPath: directory.Path, windows: true).Command;
|
||||
Assert.NotNull(command); Assert.Equal(node, command.FileName); Assert.Equal([script], command.PrefixArguments);
|
||||
}
|
||||
[Fact]
|
||||
public void FindsNativeWindowsAndHonorsOverride()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
using System.Text.Json;
|
||||
using System.Threading.Channels;
|
||||
using FinalToken.Core.Collectors;
|
||||
using FinalToken.Core.Processes;
|
||||
using Xunit;
|
||||
|
||||
namespace FinalToken.Core.Tests;
|
||||
|
||||
public sealed class ReviewRegressionTests
|
||||
{
|
||||
private static CliCommand Child(string mode) => new(Path.Combine(AppContext.BaseDirectory, "ProcessHost",
|
||||
OperatingSystem.IsWindows() ? "FinalToken.ProcessHost.exe" : "FinalToken.ProcessHost"), [mode]);
|
||||
|
||||
[Theory]
|
||||
[InlineData("--rpc-success", true)]
|
||||
[InlineData("--rpc-error", false)]
|
||||
[InlineData("--rpc-init-error", false)]
|
||||
[InlineData("--rpc-eof", false)]
|
||||
[InlineData("--rpc-garbage", false)]
|
||||
[InlineData("--rpc-shape", false)]
|
||||
[InlineData("--rpc-bound", false)]
|
||||
public async Task RpcChildFailuresBecomeFailedProbes(string mode, bool success)
|
||||
{
|
||||
using var directory = new TestDirectory();
|
||||
var log = new DiagnosticLog();
|
||||
var probe = new LimitProbe(new ProcessRunner(), log, directory.Path);
|
||||
var result = await probe.RunAsync(Provider.Codex, Child(mode), new TestClock().GetUtcNow(), TestContext.Current.CancellationToken);
|
||||
Assert.Equal(success, result.Success);
|
||||
if (!success) { Assert.Empty(result.Windows); Assert.NotNull(result.Reason); Assert.NotEmpty(log.Recent); }
|
||||
else Assert.Single(result.Windows);
|
||||
}
|
||||
[Theory]
|
||||
[InlineData("--rpc-error", false)]
|
||||
[InlineData("--rpc-eof", false)]
|
||||
[InlineData("--rpc-garbage", false)]
|
||||
[InlineData("--rpc-error", true)]
|
||||
public async Task EngineKeepsUpdatingClaudeWhenCodexFails(string mode, bool fallback)
|
||||
{
|
||||
using var directory = new TestDirectory();
|
||||
var clock = new TestClock();
|
||||
var runner = new FakeRunner { Handler = (request, token) => request.CodexRpc
|
||||
? new ProcessRunner().RunAsync(request, token) : Task.FromResult(new ProcessResult(0, Fixtures.ClaudeEnvelope)) };
|
||||
if (fallback) directory.Write("codex/sessions/rollout-fixture.jsonl", Fixtures.Meta + Fixtures.Codex(10));
|
||||
await using var engine = new RefreshEngine(directory.Path, clock, runner, Path.Combine(directory.Path, "claude"),
|
||||
Path.Combine(directory.Path, "codex"), (provider, _) => new(provider == Provider.Codex ? Child(mode) : new("fixture", []), null));
|
||||
var snapshots = Channel.CreateUnbounded<Snapshot>(); engine.SnapshotChanged += value => snapshots.Writer.TryWrite(value);
|
||||
using var deadline = CancellationTokenSource.CreateLinkedTokenSource(TestContext.Current.CancellationToken);
|
||||
deadline.CancelAfter(TimeSpan.FromSeconds(15));
|
||||
await engine.StartAsync(deadline.Token);
|
||||
var initial = await snapshots.Reader.ReadAsync(deadline.Token);
|
||||
var first = initial.Providers.Single(p => p.Provider == Provider.Claude).Windows[0].Window.SampleTime;
|
||||
clock.Advance(TimeSpan.FromMinutes(5));
|
||||
var snapshot = await snapshots.Reader.ReadAsync(deadline.Token);
|
||||
var claude = snapshot.Providers.Single(p => p.Provider == Provider.Claude);
|
||||
Assert.Equal(ProviderStatus.Available, claude.Status); Assert.True(claude.Windows[0].Window.SampleTime > first);
|
||||
var codex = snapshot.Providers.Single(p => p.Provider == Provider.Codex);
|
||||
Assert.Equal(fallback ? ProviderStatus.Available : ProviderStatus.Unavailable, codex.Status);
|
||||
if (fallback) Assert.Contains("rollout", codex.Reason); else Assert.Empty(codex.Windows);
|
||||
await engine.StopAsync();
|
||||
}
|
||||
[Fact]
|
||||
public async Task BackgroundLoopRecoversAfterCorruptMonthAndStopsCleanly()
|
||||
{
|
||||
using var directory = new TestDirectory();
|
||||
var bad = directory.Write("history/2026-10.json", "{");
|
||||
var clock = new TestClock();
|
||||
await using var engine = new RefreshEngine(directory.Path, clock, new FakeRunner(), directory.Path, directory.Path, (_, _) => new(new("fixture", []), null));
|
||||
var snapshots = Channel.CreateUnbounded<Snapshot>();
|
||||
engine.SnapshotChanged += value => snapshots.Writer.TryWrite(value);
|
||||
await engine.StartAsync(TestContext.Current.CancellationToken);
|
||||
using var deadline = CancellationTokenSource.CreateLinkedTokenSource(TestContext.Current.CancellationToken);
|
||||
deadline.CancelAfter(TimeSpan.FromSeconds(15));
|
||||
while (!engine.RecentDiagnostics.Any(d => d.Code == "refresh-failed")) await Task.Delay(10, deadline.Token);
|
||||
await File.WriteAllTextAsync(bad, "{\"v\":1,\"buckets\":[],\"limits\":[]}", deadline.Token);
|
||||
clock.Advance(TimeSpan.FromSeconds(1));
|
||||
var first = await snapshots.Reader.ReadAsync(deadline.Token);
|
||||
clock.Advance(TimeSpan.FromMinutes(5));
|
||||
var second = await snapshots.Reader.ReadAsync(deadline.Token);
|
||||
Assert.True(second.MadeAt > first.MadeAt);
|
||||
await engine.StopAsync();
|
||||
}
|
||||
[Fact]
|
||||
public async Task ProbeDoesNotSwallowShutdownCancellation()
|
||||
{
|
||||
using var directory = new TestDirectory();
|
||||
using var stop = new CancellationTokenSource(); stop.Cancel();
|
||||
var runner = new FakeRunner { Handler = (_, token) => Task.FromCanceled<ProcessResult>(token) };
|
||||
await Assert.ThrowsAnyAsync<OperationCanceledException>(() => new LimitProbe(runner, new(), directory.Path)
|
||||
.RunAsync(Provider.Codex, Child("--rpc-error"), DateTimeOffset.UtcNow, stop.Token));
|
||||
}
|
||||
[Fact]
|
||||
public async Task ShutdownWinsWhenAProcessFailureRacesCancellation()
|
||||
{
|
||||
using var directory = new TestDirectory();
|
||||
using var stop = new CancellationTokenSource();
|
||||
var runner = new FakeRunner { Handler = (_, _) => { stop.Cancel(); throw new InvalidDataException("synthetic failure during shutdown"); } };
|
||||
await Assert.ThrowsAnyAsync<OperationCanceledException>(() => new LimitProbe(runner, new(), directory.Path)
|
||||
.RunAsync(Provider.Codex, Child("--rpc-error"), DateTimeOffset.UtcNow, stop.Token));
|
||||
}
|
||||
[Theory]
|
||||
[InlineData("Africa/Cairo", "2026-04-24")]
|
||||
[InlineData("America/Santiago", "2026-09-06")]
|
||||
[InlineData("Asia/Beirut", "2026-03-29")]
|
||||
public void TotalsSurviveMissingLocalMidnight(string zoneId, string dateText)
|
||||
{
|
||||
var zone = TimeZoneInfo.FindSystemTimeZoneById(zoneId);
|
||||
var date = DateTime.ParseExact(dateText, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
|
||||
Assert.True(zone.IsInvalidTime(date));
|
||||
VerifyTotals(zone, date);
|
||||
}
|
||||
[Fact]
|
||||
public void WeekCanStartOnAMondayWithNoMidnight()
|
||||
{
|
||||
var rule = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new(2026, 1, 1), new(2026, 12, 31), TimeSpan.FromHours(1),
|
||||
TimeZoneInfo.TransitionTime.CreateFixedDateRule(new(1, 1, 1), 3, 30),
|
||||
TimeZoneInfo.TransitionTime.CreateFixedDateRule(new(1, 1, 1), 10, 1));
|
||||
var zone = TimeZoneInfo.CreateCustomTimeZone("Monday gap", TimeSpan.Zero, "Monday gap", "standard", "summer", [rule]);
|
||||
VerifyTotals(zone, new(2026, 3, 30));
|
||||
using var directory = new TestDirectory();
|
||||
var store = new HistoryStore(directory.Path, new());
|
||||
var monday = new DateTimeOffset(2026, 3, 30, 1, 0, 0, TimeSpan.FromHours(1));
|
||||
store.Add(new(Provider.Codex, monday.AddHours(-1), null, null, new(Total: 7), "before-week"));
|
||||
store.Add(new(Provider.Codex, monday, null, null, new(Total: 11), "in-week"));
|
||||
var wednesday = new DateTimeOffset(2026, 4, 1, 12, 0, 0, TimeSpan.FromHours(1));
|
||||
store.Add(new(Provider.Codex, wednesday.AddHours(-1), null, null, new(Total: 13), "today"));
|
||||
var totals = store.Totals(Provider.Codex, wednesday, null, zone);
|
||||
Assert.Equal(13, totals.Today.Total); Assert.Equal(24, totals.Week.Total);
|
||||
}
|
||||
private static void VerifyTotals(TimeZoneInfo zone, DateTime date)
|
||||
{
|
||||
using var directory = new TestDirectory();
|
||||
var store = new HistoryStore(directory.Path, new());
|
||||
var first = new DateTimeOffset(date.AddHours(1), zone.GetUtcOffset(date.AddHours(1)));
|
||||
var now = first.AddHours(10);
|
||||
store.Add(new(Provider.Codex, first.AddHours(-1), null, null, new(Total: 7), "before"));
|
||||
store.Add(new(Provider.Codex, first, null, null, new(Total: 11), "inside"));
|
||||
var totals = store.Totals(Provider.Codex, now, null, zone);
|
||||
Assert.Equal(11, totals.Today.Total);
|
||||
Assert.Equal(date.DayOfWeek == DayOfWeek.Monday ? 11 : 18, totals.Week.Total);
|
||||
}
|
||||
}
|
||||
@@ -4,3 +4,5 @@ handles, then runs Core's ProcessRunner. Child modes check handles and synthetic
|
||||
live Claude mode keeps provider output in memory and writes only diagnostic metadata.
|
||||
No provider text or real transcript fixtures belong here. JSON uses source generation.
|
||||
Built with Core tests; run `dotnet test --project tests/FinalToken.Core.Tests -c Release`.
|
||||
Portable `--rpc-*` modes provide synthetic app-server exchanges, errors, EOF and malformed output.
|
||||
The `app-server` mode returns an RPC error for published-CLI checks; it never contacts a provider.
|
||||
|
||||
@@ -11,6 +11,8 @@ public static class Program
|
||||
{
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
if (args.FirstOrDefault() is { } mode && (mode.StartsWith("--rpc-", StringComparison.Ordinal) || mode == "app-server"))
|
||||
return await RpcAsync(mode == "app-server" ? "--rpc-error" : mode);
|
||||
if (!OperatingSystem.IsWindows()) return 0;
|
||||
if (args is ["--handles"])
|
||||
return new[] { -10, -11, -12 }.All(id => Native.GetFileType(Native.GetStdHandle(id)) != 0) ? 0 : 17;
|
||||
@@ -42,6 +44,32 @@ public static class Program
|
||||
await AtomicFile.WriteAsync(args[1], JsonSerializer.Serialize(report, ProbeJsonContext.Default.ProbeReport));
|
||||
return live ? report.WindowCount > 0 ? 0 : 18 : utf8 ? report.Utf8Matched ? 0 : 19 : result.ExitCode;
|
||||
}
|
||||
private static async Task<int> RpcAsync(string mode)
|
||||
{
|
||||
Console.InputEncoding = System.Text.Encoding.UTF8;
|
||||
Console.OutputEncoding = new System.Text.UTF8Encoding(false);
|
||||
if (mode == "--rpc-eof") return 0;
|
||||
var initialize = await Console.In.ReadLineAsync();
|
||||
using var first = JsonDocument.Parse(initialize ?? "null");
|
||||
if (first.RootElement.GetProperty("method").GetString() != "initialize") return 20;
|
||||
if (mode == "--rpc-init-error") { await Console.Out.WriteLineAsync("{\"id\":1,\"error\":{\"code\":-1,\"message\":\"synthetic error\"}}"); return 0; }
|
||||
await Console.Out.WriteLineAsync("{\"id\":1,\"result\":{}}");
|
||||
using var initialized = JsonDocument.Parse(await Console.In.ReadLineAsync() ?? "null");
|
||||
using var request = JsonDocument.Parse(await Console.In.ReadLineAsync() ?? "null");
|
||||
if (initialized.RootElement.GetProperty("method").GetString() != "initialized" ||
|
||||
request.RootElement.GetProperty("method").GetString() != "account/rateLimits/read") return 21;
|
||||
await Console.Out.WriteLineAsync("{\"method\":\"syntheticNotification\"}");
|
||||
var response = mode switch
|
||||
{
|
||||
"--rpc-error" => "{\"id\":2,\"error\":{\"code\":-1,\"message\":\"synthetic error\"}}",
|
||||
"--rpc-garbage" => "not JSON",
|
||||
"--rpc-shape" => "[]",
|
||||
"--rpc-bound" => new string('x', 1024 * 1024 + 1),
|
||||
_ => "{\"id\":2,\"result\":{\"rateLimits\":{\"limitId\":\"codex\",\"primary\":{\"usedPercent\":24,\"windowDurationMins\":10080,\"resetsAt\":1792479531}}}}"
|
||||
};
|
||||
await Console.Out.WriteLineAsync(response);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed record ProbeReport
|
||||
|
||||
@@ -7,6 +7,14 @@ namespace FinalToken.StreamDeck.Tests;
|
||||
|
||||
public sealed class PluginTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task InvalidHostFrameEndsConnectionWithoutLoggingFrameText()
|
||||
{
|
||||
var socket = new FakeSocket { ReceiveFailure = new InvalidDataException("synthetic private frame") };
|
||||
var session = new PluginSession(socket, _ => Task.FromResult(false));
|
||||
Assert.Null(await session.ReceiveAsync(TestContext.Current.CancellationToken));
|
||||
Assert.Equal("connection-ended", session.ConnectionEndCode);
|
||||
}
|
||||
[Theory]
|
||||
[InlineData("{}", "Claude", "SessionPercent", "")]
|
||||
[InlineData("{\"provider\":\"Codex\"}", "Codex", "SessionPercent", "")]
|
||||
@@ -146,9 +154,11 @@ public sealed class PluginTests
|
||||
}
|
||||
private sealed class FakeSocket : IPluginSocket
|
||||
{
|
||||
public Exception? ReceiveFailure { get; init; }
|
||||
public List<string> Sent { get; } = [];
|
||||
public Task SendAsync(string json, CancellationToken cancellationToken) { Sent.Add(json); return Task.CompletedTask; }
|
||||
public Task<string?> ReceiveAsync(CancellationToken cancellationToken) => Task.FromResult<string?>(null);
|
||||
public Task<string?> ReceiveAsync(CancellationToken cancellationToken) => ReceiveFailure is { } error
|
||||
? Task.FromException<string?>(error) : Task.FromResult<string?>(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user