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
@@ -37,7 +37,7 @@ public sealed class InstanceSocketTests : IDisposable
|
||||
catch { /* A leftover test folder does not turn a run red. */ }
|
||||
}
|
||||
|
||||
private AppHost NeuerHost(bool mitWeboberflaeche, int port = 0)
|
||||
private AppHost NewHost(bool withWebUi, int port = 0)
|
||||
{
|
||||
var instancesDir = Path.Combine(_root, "Instances");
|
||||
var instancePath = Path.Combine(instancesDir, "Test");
|
||||
@@ -51,9 +51,9 @@ public sealed class InstanceSocketTests : IDisposable
|
||||
{
|
||||
InstanceName = "Test",
|
||||
WorkingDirectory = instancePath,
|
||||
WebUiEnabled = mitWeboberflaeche,
|
||||
WebUiEnabled = withWebUi,
|
||||
WebUiBinding = "loopback",
|
||||
WebUiToken = mitWeboberflaeche ? Token : "",
|
||||
WebUiToken = withWebUi ? Token : "",
|
||||
WebServerPort = port
|
||||
},
|
||||
InstancePath = instancePath,
|
||||
@@ -63,7 +63,7 @@ public sealed class InstanceSocketTests : IDisposable
|
||||
};
|
||||
}
|
||||
|
||||
private static int FreierPort()
|
||||
private static int FreePort()
|
||||
{
|
||||
using var probe = new System.Net.Sockets.TcpListener(System.Net.IPAddress.Loopback, 0);
|
||||
probe.Start();
|
||||
@@ -75,27 +75,27 @@ public sealed class InstanceSocketTests : IDisposable
|
||||
// ─── The socket holds ───
|
||||
|
||||
[Fact]
|
||||
public async Task Der_Socket_antwortet_auch_ohne_Weboberflaeche()
|
||||
public async Task The_socket_answers_even_without_web_UI()
|
||||
{
|
||||
// The default: webUiEnabled is off. Formerly nothing ran at all then, and the
|
||||
// instance was not addressable from outside.
|
||||
await using var host = NeuerHost(mitWeboberflaeche: false);
|
||||
await using var host = NewHost(withWebUi: false);
|
||||
await using var web = InstanceHttpHost.TryStart(host, NullLoggerFactory.Instance);
|
||||
|
||||
web.ShouldNotBeNull();
|
||||
web!.Url.ShouldBeNull();
|
||||
|
||||
using var client = InstanceEndpoint.CreateClient(host.InstancePath);
|
||||
var antwort = await client.GetAsync("/api/info");
|
||||
var answer = await client.GetAsync("/api/info");
|
||||
|
||||
antwort.EnsureSuccessStatusCode();
|
||||
(await antwort.Content.ReadAsStringAsync()).ShouldContain("Test");
|
||||
answer.EnsureSuccessStatusCode();
|
||||
(await answer.Content.ReadAsStringAsync()).ShouldContain("Test");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Ueber_den_Socket_braucht_es_kein_Token()
|
||||
public async Task Over_the_socket_no_token_is_needed()
|
||||
{
|
||||
await using var host = NeuerHost(mitWeboberflaeche: true, port: FreierPort());
|
||||
await using var host = NewHost(withWebUi: true, port: FreePort());
|
||||
await using var web = InstanceHttpHost.TryStart(host, NullLoggerFactory.Instance);
|
||||
|
||||
web.ShouldNotBeNull();
|
||||
@@ -108,11 +108,11 @@ public sealed class InstanceSocketTests : IDisposable
|
||||
// ─── The port stays guarded ───
|
||||
|
||||
[Fact]
|
||||
public async Task Ueber_TCP_gilt_die_Token_Pflicht_weiter()
|
||||
public async Task Over_TCP_the_token_requirement_still_applies()
|
||||
{
|
||||
var port = FreierPort();
|
||||
var port = FreePort();
|
||||
|
||||
await using var host = NeuerHost(mitWeboberflaeche: true, port: port);
|
||||
await using var host = NewHost(withWebUi: true, port: port);
|
||||
await using var web = InstanceHttpHost.TryStart(host, NullLoggerFactory.Instance);
|
||||
|
||||
web.ShouldNotBeNull();
|
||||
@@ -130,7 +130,7 @@ public sealed class InstanceSocketTests : IDisposable
|
||||
// ─── Addresses ───
|
||||
|
||||
[Fact]
|
||||
public void Zwei_Instanzen_bekommen_zwei_Adressen()
|
||||
public void Two_instances_get_two_addresses()
|
||||
{
|
||||
var a = Path.Combine(_root, "Instances", "Eins");
|
||||
var b = Path.Combine(_root, "Instances", "Zwei");
|
||||
@@ -140,7 +140,7 @@ public sealed class InstanceSocketTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Dieselbe_Instanz_bekommt_dieselbe_Adresse()
|
||||
public void The_same_instance_gets_the_same_address()
|
||||
{
|
||||
// The manager computes the address from the path it knows itself — so it
|
||||
// must come out the same from every spelling of the same directory.
|
||||
@@ -161,12 +161,12 @@ public sealed class InstanceSocketTests : IDisposable
|
||||
/// <c>EADDRINUSE</c> from a process that no longer exists.</para>
|
||||
/// </summary>
|
||||
[SocketFileFact]
|
||||
public async Task Eine_liegengebliebene_Socketdatei_haelt_den_Start_nicht_auf()
|
||||
public async Task A_leftover_socket_file_does_not_hold_up_the_start()
|
||||
{
|
||||
await using var host = NeuerHost(mitWeboberflaeche: false);
|
||||
await using var host = NewHost(withWebUi: false);
|
||||
|
||||
var leiche = InstanceEndpoint.SocketPath(host.InstancePath);
|
||||
File.WriteAllText(leiche, "Rest eines abgestuerzten Prozesses");
|
||||
var corpse = InstanceEndpoint.SocketPath(host.InstancePath);
|
||||
File.WriteAllText(corpse, "Rest eines abgestuerzten Prozesses");
|
||||
|
||||
await using var web = InstanceHttpHost.TryStart(host, NullLoggerFactory.Instance);
|
||||
web.ShouldNotBeNull();
|
||||
@@ -176,9 +176,9 @@ public sealed class InstanceSocketTests : IDisposable
|
||||
}
|
||||
|
||||
[SocketFileFact]
|
||||
public async Task Beim_Beenden_bleibt_keine_Socketdatei_liegen()
|
||||
public async Task Shutdown_leaves_no_socket_file_behind()
|
||||
{
|
||||
await using var host = NeuerHost(mitWeboberflaeche: false);
|
||||
await using var host = NewHost(withWebUi: false);
|
||||
|
||||
var web = InstanceHttpHost.TryStart(host, NullLoggerFactory.Instance);
|
||||
web.ShouldNotBeNull();
|
||||
@@ -212,7 +212,7 @@ public sealed class InstanceControlTests : IDisposable
|
||||
catch { /* A leftover test folder does not turn a run red. */ }
|
||||
}
|
||||
|
||||
private AppHost NeuerHost(int port)
|
||||
private AppHost NewHost(int port)
|
||||
{
|
||||
var instancesDir = Path.Combine(_root, "Instances");
|
||||
var instancePath = Path.Combine(instancesDir, "Test");
|
||||
@@ -238,7 +238,7 @@ public sealed class InstanceControlTests : IDisposable
|
||||
};
|
||||
}
|
||||
|
||||
private static int FreierPort()
|
||||
private static int FreePort()
|
||||
{
|
||||
using var probe = new System.Net.Sockets.TcpListener(System.Net.IPAddress.Loopback, 0);
|
||||
probe.Start();
|
||||
@@ -248,18 +248,18 @@ public sealed class InstanceControlTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Ueber_TCP_gibt_es_die_Steuerung_nicht()
|
||||
public async Task Over_TCP_there_is_no_control()
|
||||
{
|
||||
var port = FreierPort();
|
||||
var port = FreePort();
|
||||
|
||||
await using var host = NeuerHost(port);
|
||||
await using var host = NewHost(port);
|
||||
await using var web = InstanceHttpHost.TryStart(host, NullLoggerFactory.Instance);
|
||||
|
||||
web.ShouldNotBeNull();
|
||||
web!.Url.ShouldNotBeNull();
|
||||
|
||||
var gebeten = false;
|
||||
web.Control.ShutdownRequested += () => gebeten = true;
|
||||
var requested = false;
|
||||
web.Control.ShutdownRequested += () => requested = true;
|
||||
|
||||
using var client = new HttpClient { BaseAddress = new Uri($"http://127.0.0.1:{port}") };
|
||||
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {Token}");
|
||||
@@ -268,6 +268,6 @@ public sealed class InstanceControlTests : IDisposable
|
||||
(await client.PostAsync("/api/instanz/beenden", content: null)).StatusCode
|
||||
.ShouldBe(System.Net.HttpStatusCode.NotFound);
|
||||
|
||||
gebeten.ShouldBeFalse();
|
||||
requested.ShouldBeFalse();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user