Rund 2.600 Kommentarblöcke in 310 C#-Dateien übersetzt, Begründungen vollständig erhalten: blockweise gleiche Anzahl wie vorher, kein Block unter 60 % seiner Länge, der Code außerhalb der Kommentare per Tokenizer byte-identisch geprüft. Zitate deutscher Oberflächentexte und Testdaten bleiben deutsch. WebUI: Kommentare in JS/CSS/HTML übersetzt, JSDoc-@param an die in 4b umbenannten Parameter angeglichen. Dabei behoben: - 4b hatte "tag" (HTML-Tag) als deutsches "Tag" gelesen und zu "dayValue" gemacht (makeElement, svg, Tagesübersicht) - zurück auf tag/day. - Aufgaben "InProgress" bekamen die Plakettenart "laufend", für die es nie eine CSS-Klasse gab - jetzt "success" wie laufende Instanzen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2.3 KiB
C#
69 lines
2.3 KiB
C#
using ClawdDotNet.App.Services;
|
|
using ClawdDotNet.App.Settings;
|
|
using ClawdDotNet.Core.Config;
|
|
using ClawdDotNet.Core.Tools;
|
|
using Microsoft.Extensions.Logging.Abstractions;
|
|
using ClawdDotNet.Core.Instances;
|
|
|
|
namespace ClawdDotNet.App.Tests.Services;
|
|
|
|
/// <summary>
|
|
/// An <see cref="AppHost"/> without engine, scanner and network — enough for the
|
|
/// administration services.
|
|
///
|
|
/// <para>This is possible because <c>AppHost.StartAsync</c> is only <em>one</em> way to
|
|
/// build one: the properties are <c>required init</c>, nothing more is needed. What
|
|
/// is missing here — <c>Engine</c>, <c>Scanner</c>, <c>Staging</c> — is regularly null in operation
|
|
/// too, and exactly that behavior is to be tested.</para>
|
|
/// </summary>
|
|
internal sealed class TestHost : IDisposable
|
|
{
|
|
private readonly string _root;
|
|
|
|
public AppHost Host { get; }
|
|
|
|
/// <summary>Every change that went through <c>SaveInstance</c>.</summary>
|
|
public List<InstanceChange> Changes { get; } = [];
|
|
|
|
public TestHost(params AgentConfig[] agents)
|
|
{
|
|
_root = Path.Combine(
|
|
Path.GetTempPath(), "clawd-tests", "host-" + Guid.NewGuid().ToString("N")[..8]);
|
|
|
|
var instancesDir = Path.Combine(_root, "Instances");
|
|
var instancePath = Path.Combine(instancesDir, "Test");
|
|
|
|
Directory.CreateDirectory(instancePath);
|
|
|
|
var instance = new InstanceConfig { InstanceName = "Test" };
|
|
instance.Agents.AddRange(agents);
|
|
|
|
Host = new AppHost
|
|
{
|
|
Settings = new SettingsManager(_root),
|
|
Directories = new InstanceDirectoryManager(instancesDir),
|
|
Instance = instance,
|
|
InstancePath = instancePath,
|
|
LogDirectory = Path.Combine(_root, "Logs"),
|
|
LoggerFactory = NullLoggerFactory.Instance,
|
|
Tools = new ToolRegistry()
|
|
};
|
|
|
|
Host.InstanceChanged += Changes.Add;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
try { Directory.Delete(_root, recursive: true); }
|
|
catch { /* A leftover test folder is no reason to turn a run red. */ }
|
|
}
|
|
|
|
public static AgentConfig Agent(string agentId, string displayName = "")
|
|
=> new()
|
|
{
|
|
AgentId = agentId,
|
|
DisplayName = displayName.Length == 0 ? agentId : displayName,
|
|
Model = "anthropic/claude-sonnet-4-5"
|
|
};
|
|
}
|