Stufe 4c (#764): Bezeichner auf Englisch - Typen, Methoden, Felder, Parameter, Locals, Testnamen
Mit Roslyn umbenannt (Verweise folgen, Zeichenketten bleiben unberuehrt). Nicht umbenannt, weil gespeichert oder ueber die API gebunden (Stufe 4e): Properties, Record-Parameter, Enum-Member sowie die Parameter der Endpunkt-Handler (Routen-/Query-Bindung ueber den Namen). Die JSON-Felder anonymer Objekte bleiben ausdruecklich benannt (JsonFilter: pfad). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
837a634a22
commit
77062facc9
@@ -16,19 +16,19 @@ namespace ClawdDotNet.App.Tests.Services;
|
||||
public sealed class AgentAdministrationTests
|
||||
{
|
||||
[Fact]
|
||||
public void Eine_doppelte_Agenten_ID_wird_abgelehnt()
|
||||
public void A_duplicate_agent_ID_is_rejected()
|
||||
{
|
||||
using var host = new TestHost(TestHost.Agent("scout"));
|
||||
|
||||
var ergebnis = host.Host.AgentAdmin.Add(new NewAgent("scout", "Scout", "modell"));
|
||||
var result = host.Host.AgentAdmin.Add(new NewAgent("scout", "Scout", "modell"));
|
||||
|
||||
ergebnis.Ok.ShouldBeFalse();
|
||||
ergebnis.Message.ShouldContain("existiert bereits");
|
||||
result.Ok.ShouldBeFalse();
|
||||
result.Message.ShouldContain("existiert bereits");
|
||||
host.Host.Instance.Agents.Count.ShouldBe(1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Die_Pruefung_ignoriert_Gross_und_Kleinschreibung()
|
||||
public void The_check_ignores_case()
|
||||
{
|
||||
// Two agents differing only in that would be two folders on the target platform
|
||||
// and the same agent to every human.
|
||||
@@ -38,7 +38,7 @@ public sealed class AgentAdministrationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ohne_ID_wird_kein_Agent_angelegt()
|
||||
public void Without_ID_no_agent_is_created()
|
||||
{
|
||||
using var host = new TestHost();
|
||||
|
||||
@@ -47,7 +47,7 @@ public sealed class AgentAdministrationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_angelegter_Agent_ueberlebt_den_Neustart()
|
||||
public void A_created_agent_survives_the_restart()
|
||||
{
|
||||
// The core of the finding: LoadInstanceConfig clears the agent list and rebuilds it
|
||||
// from the folders Agents/Agent-*. An agent that only stood in
|
||||
@@ -57,13 +57,13 @@ public sealed class AgentAdministrationTests
|
||||
|
||||
host.Host.AgentAdmin.Add(new NewAgent("scout", "Scout", "modell", "Späher")).Ok.ShouldBeTrue();
|
||||
|
||||
var nachNeustart = host.Host.Directories.LoadInstanceConfig(host.Host.InstancePath);
|
||||
var afterRestart = host.Host.Directories.LoadInstanceConfig(host.Host.InstancePath);
|
||||
|
||||
nachNeustart.Agents.ShouldContain(a => a.AgentId == "scout" && a.DisplayName == "Scout");
|
||||
afterRestart.Agents.ShouldContain(a => a.AgentId == "scout" && a.DisplayName == "Scout");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Aenderungen_an_einem_Agenten_ueberleben_den_Neustart()
|
||||
public void Changes_to_an_agent_survive_the_restart()
|
||||
{
|
||||
// The same cause from the other direction: until 2026-09-06 nobody called
|
||||
// SaveAgentSettings during operation. Model, prompt and budget only stood in
|
||||
@@ -79,17 +79,17 @@ public sealed class AgentAdministrationTests
|
||||
|
||||
host.Host.AgentAdmin.Save();
|
||||
|
||||
var nachNeustart = host.Host.Directories
|
||||
var afterRestart = host.Host.Directories
|
||||
.LoadInstanceConfig(host.Host.InstancePath).Agents
|
||||
.Single(a => a.AgentId == "scout");
|
||||
|
||||
nachNeustart.Model.ShouldBe("neues-modell");
|
||||
nachNeustart.Budget.DailyTokens.ShouldBe(12_345);
|
||||
nachNeustart.Identity.ShouldBe("# Identity: geändert");
|
||||
afterRestart.Model.ShouldBe("neues-modell");
|
||||
afterRestart.Budget.DailyTokens.ShouldBe(12_345);
|
||||
afterRestart.Identity.ShouldBe("# Identity: geändert");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_Werkzeug_bleibt_ueber_den_Neustart_zugelassen()
|
||||
public void A_tool_stays_allowed_across_the_restart()
|
||||
{
|
||||
using var host = new TestHost();
|
||||
|
||||
@@ -103,7 +103,7 @@ public sealed class AgentAdministrationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Jede_Aenderung_meldet_sich()
|
||||
public void Every_change_reports_itself()
|
||||
{
|
||||
// Without this notification an agent created in the web UI would not appear in the
|
||||
// running window — the whole reason the event exists.
|
||||
@@ -117,7 +117,7 @@ public sealed class AgentAdministrationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_entfernter_Agent_kommt_nach_dem_Neustart_nicht_wieder()
|
||||
public void A_removed_agent_does_not_return_after_the_restart()
|
||||
{
|
||||
// The opposite direction of the same finding: merely striking it from the list was not
|
||||
// enough — the folder stayed behind, and at the next start the agent was
|
||||
@@ -133,7 +133,7 @@ public sealed class AgentAdministrationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_entfernter_Agent_behaelt_seine_Arbeit()
|
||||
public void A_removed_agent_keeps_its_work()
|
||||
{
|
||||
// Renamed, not deleted. Its work is in the working folder, and a click
|
||||
// in a list is no decision to throw it away.
|
||||
@@ -141,10 +141,10 @@ public sealed class AgentAdministrationTests
|
||||
|
||||
host.Host.AgentAdmin.Add(new NewAgent("scout", "Scout", "modell"));
|
||||
|
||||
var arbeitsdatei = Path.Combine(
|
||||
var workFile = Path.Combine(
|
||||
host.Host.AgentAdmin.Find("scout")!.AgentDir, "Workspace", "ergebnis.txt");
|
||||
|
||||
File.WriteAllText(arbeitsdatei, "wichtig");
|
||||
File.WriteAllText(workFile, "wichtig");
|
||||
|
||||
host.Host.AgentAdmin.Remove("scout").Ok.ShouldBeTrue();
|
||||
|
||||
@@ -157,7 +157,7 @@ public sealed class AgentAdministrationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_Werkzeug_zulassen_legt_eine_leere_Konfiguration_an()
|
||||
public void Allowing_a_tool_creates_an_empty_configuration()
|
||||
{
|
||||
using var host = new TestHost(TestHost.Agent("scout"));
|
||||
|
||||
@@ -170,7 +170,7 @@ public sealed class AgentAdministrationTests
|
||||
// ─── #641: permissions in the tool configuration ───
|
||||
|
||||
[Fact]
|
||||
public void Rechte_werden_normalisiert_gespeichert_und_ueberleben_den_Neustart()
|
||||
public void Rights_are_stored_normalised_and_survive_the_restart()
|
||||
{
|
||||
using var host = new TestHost();
|
||||
host.Host.AgentAdmin.Add(new NewAgent("scout", "Scout", "modell"));
|
||||
@@ -178,15 +178,15 @@ public sealed class AgentAdministrationTests
|
||||
|
||||
host.Host.AgentAdmin.SetToolRights("scout", "Database", ["SELECT", "Insert", "drop"], ["drop"]).Ok.ShouldBeTrue();
|
||||
|
||||
var rechte = ClawdDotNet.Core.Staging.Werkzeugrechte.Aus(
|
||||
var rights = ClawdDotNet.Core.Staging.ToolRights.From(
|
||||
host.Host.Directories.LoadInstanceConfig(host.Host.InstancePath).Agents
|
||||
.Single(a => a.AgentId == "scout").Tools["Database"].AsReadOnly());
|
||||
rechte.Erlaubt.ShouldNotBeNull().OrderBy(x => x).ToArray().ShouldBe(["insert", "select"], "verboten schlaegt erlaubt");
|
||||
rechte.IstVerboten("DROP").ShouldBeTrue();
|
||||
rights.Erlaubt.ShouldNotBeNull().OrderBy(x => x).ToArray().ShouldBe(["insert", "select"], "verboten schlaegt erlaubt");
|
||||
rights.IsForbidden("DROP").ShouldBeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Einstellungen_speichern_loescht_die_Rechte_nicht()
|
||||
public void Saving_settings_does_not_delete_the_rights()
|
||||
{
|
||||
// The settings forms write a fresh dictionary without "erlaubt".
|
||||
using var host = new TestHost(TestHost.Agent("scout"));
|
||||
@@ -218,7 +218,7 @@ public sealed class AgentAdministrationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Rechte_nur_fuer_zugewiesene_Werkzeuge()
|
||||
public void Rights_only_for_assigned_tools()
|
||||
{
|
||||
using var host = new TestHost(TestHost.Agent("scout"));
|
||||
|
||||
@@ -226,7 +226,7 @@ public sealed class AgentAdministrationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_Werkzeug_wegnehmen_entfernt_auch_seine_Einstellungen()
|
||||
public void Removing_a_tool_also_removes_its_settings()
|
||||
{
|
||||
using var host = new TestHost(TestHost.Agent("scout"));
|
||||
|
||||
@@ -239,7 +239,7 @@ public sealed class AgentAdministrationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Einstellungen_zu_schreiben_heisst_das_Werkzeug_zu_wollen()
|
||||
public void Writing_settings_means_wanting_the_tool()
|
||||
{
|
||||
using var host = new TestHost(TestHost.Agent("scout"));
|
||||
|
||||
@@ -250,7 +250,7 @@ public sealed class AgentAdministrationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_unbekannter_Agent_liefert_eine_Antwort_und_keine_Ausnahme()
|
||||
public void An_unknown_agent_returns_an_answer_and_no_exception()
|
||||
{
|
||||
using var host = new TestHost();
|
||||
|
||||
@@ -263,20 +263,20 @@ public sealed class AgentAdministrationTests
|
||||
public sealed class JobAdministrationTests
|
||||
{
|
||||
[Fact]
|
||||
public void Ein_unlesbarer_Zeitplan_wird_abgelehnt()
|
||||
public void An_unreadable_schedule_is_rejected()
|
||||
{
|
||||
using var host = new TestHost(TestHost.Agent("scout"));
|
||||
|
||||
var ergebnis = host.Host.JobAdmin.Add(new JobDefinition(
|
||||
var result = host.Host.JobAdmin.Add(new JobDefinition(
|
||||
"scout", JobKind.AgentWakeup, Cron: "jeden zweiten Dienstag"));
|
||||
|
||||
ergebnis.Ok.ShouldBeFalse();
|
||||
ergebnis.Message.ShouldContain("nicht lesbar");
|
||||
result.Ok.ShouldBeFalse();
|
||||
result.Message.ShouldContain("nicht lesbar");
|
||||
host.Host.AgentAdmin.Find("scout")!.Scheduler.ShouldBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_leerer_Zeitplan_ist_kein_Fehler()
|
||||
public void An_empty_schedule_is_not_an_error()
|
||||
{
|
||||
// Empty means "never" and is a valid statement. Only unreadable is an error.
|
||||
using var host = new TestHost(TestHost.Agent("scout"));
|
||||
@@ -285,7 +285,7 @@ public sealed class JobAdministrationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_Wakeup_laesst_sich_nicht_abschalten()
|
||||
public void A_wakeup_cannot_be_switched_off()
|
||||
{
|
||||
// SchedulerConfig has no switch, and inventing one here would mean that
|
||||
// the scanner would first have to read it. Otherwise a "disabled"
|
||||
@@ -294,15 +294,15 @@ public sealed class JobAdministrationTests
|
||||
|
||||
host.Host.JobAdmin.Add(new JobDefinition("scout", JobKind.AgentWakeup, Cron: "0 * * * *"));
|
||||
|
||||
var ergebnis = host.Host.JobAdmin.SetEnabled(
|
||||
var result = host.Host.JobAdmin.SetEnabled(
|
||||
"scout", JobAdministration.WakeupId("scout"), enabled: false);
|
||||
|
||||
ergebnis.Ok.ShouldBeFalse();
|
||||
ergebnis.Message.ShouldContain("Nur Tool-Jobs");
|
||||
result.Ok.ShouldBeFalse();
|
||||
result.Message.ShouldContain("Nur Tool-Jobs");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_Tool_Job_laesst_sich_abschalten_ohne_ihn_zu_verlieren()
|
||||
public void A_tool_job_can_be_switched_off_without_losing_it()
|
||||
{
|
||||
using var host = new TestHost(TestHost.Agent("scout"));
|
||||
|
||||
@@ -313,13 +313,13 @@ public sealed class JobAdministrationTests
|
||||
|
||||
host.Host.JobAdmin.SetEnabled("scout", job.JobId, enabled: false).Ok.ShouldBeTrue();
|
||||
|
||||
var danach = host.Host.JobAdmin.List().Single();
|
||||
danach.Enabled.ShouldBeFalse();
|
||||
danach.ToolName.ShouldBe("Mail");
|
||||
var after = host.Host.JobAdmin.List().Single();
|
||||
after.Enabled.ShouldBeFalse();
|
||||
after.ToolName.ShouldBe("Mail");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ohne_Scanner_gilt_ein_Wakeup_als_nicht_aktiv()
|
||||
public void Without_scanner_a_wakeup_counts_as_not_active()
|
||||
{
|
||||
// It runs as long as the scanner runs — that is the only periodic
|
||||
// driver. Without it, it stands still without anyone having disabled it.
|
||||
@@ -332,7 +332,7 @@ public sealed class JobAdministrationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Der_naechste_Lauf_wird_aus_dem_Zeitplan_gerechnet()
|
||||
public void The_next_run_is_calculated_from_the_schedule()
|
||||
{
|
||||
var (next, valid) = JobAdministration.NextRun("0 * * * *");
|
||||
|
||||
@@ -342,14 +342,14 @@ public sealed class JobAdministrationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_unlesbarer_Zeitplan_ist_von_einem_fehlenden_zu_unterscheiden()
|
||||
public void An_unreadable_schedule_is_distinguishable_from_a_missing_one()
|
||||
{
|
||||
JobAdministration.NextRun("").ShouldBe((null, true));
|
||||
JobAdministration.NextRun("kaputt").ShouldBe((null, false));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_entfernter_Wakeup_ist_weg_und_der_Agent_bleibt()
|
||||
public void A_removed_wakeup_is_gone_and_the_agent_stays()
|
||||
{
|
||||
using var host = new TestHost(TestHost.Agent("scout"));
|
||||
|
||||
@@ -366,36 +366,36 @@ public sealed class JobAdministrationTests
|
||||
public sealed class ServiceAdministrationTests
|
||||
{
|
||||
[Fact]
|
||||
public void Die_eingebauten_Dienste_kommen_genau_einmal_dazu()
|
||||
public void The_built_in_services_are_added_exactly_once()
|
||||
{
|
||||
using var host = new TestHost();
|
||||
|
||||
host.Host.ServiceAdmin.EnsureBuiltIns();
|
||||
var nachDemErsten = host.Host.Instance.Services.Count;
|
||||
var afterFirst = host.Host.Instance.Services.Count;
|
||||
|
||||
host.Host.ServiceAdmin.EnsureBuiltIns();
|
||||
|
||||
nachDemErsten.ShouldBe(BuiltInServices.CreateDefaults().Count);
|
||||
host.Host.Instance.Services.Count.ShouldBe(nachDemErsten);
|
||||
afterFirst.ShouldBe(BuiltInServices.CreateDefaults().Count);
|
||||
host.Host.Instance.Services.Count.ShouldBe(afterFirst);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_abgeschalteter_eingebauter_Dienst_bleibt_abgeschaltet()
|
||||
public void A_disabled_built_in_service_stays_disabled()
|
||||
{
|
||||
using var host = new TestHost();
|
||||
|
||||
host.Host.ServiceAdmin.EnsureBuiltIns();
|
||||
|
||||
var dienst = host.Host.Instance.Services.First(s => s.BuiltIn);
|
||||
host.Host.ServiceAdmin.SetEnabled(dienst.ServiceId, enabled: false);
|
||||
var service = host.Host.Instance.Services.First(s => s.BuiltIn);
|
||||
host.Host.ServiceAdmin.SetEnabled(service.ServiceId, enabled: false);
|
||||
|
||||
host.Host.ServiceAdmin.EnsureBuiltIns();
|
||||
|
||||
host.Host.ServiceAdmin.Find(dienst.ServiceId)!.Enabled.ShouldBeFalse();
|
||||
host.Host.ServiceAdmin.Find(service.ServiceId)!.Enabled.ShouldBeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_Dienst_ohne_Namen_wird_abgelehnt()
|
||||
public void A_service_without_name_is_rejected()
|
||||
{
|
||||
using var host = new TestHost();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user