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
@@ -19,56 +19,56 @@ public sealed class OwnerOnlyFileTests : IDisposable
|
||||
try { Directory.Delete(_dir, recursive: true); } catch { /* Cleaning up is best effort */ }
|
||||
}
|
||||
|
||||
private const UnixFileMode NurBesitzer = UnixFileMode.UserRead | UnixFileMode.UserWrite;
|
||||
private const UnixFileMode OwnerOnly = UnixFileMode.UserRead | UnixFileMode.UserWrite;
|
||||
|
||||
[LinuxFact]
|
||||
[System.Runtime.Versioning.SupportedOSPlatform("linux")]
|
||||
public void AtomicFile_ersetzt_eine_offene_Datei_durch_eine_nur_fuer_den_Besitzer()
|
||||
public void AtomicFile_replaces_an_open_file_with_an_owner_only_one()
|
||||
{
|
||||
var pfad = Path.Combine(_dir, "InstanceSettings.json");
|
||||
File.WriteAllText(pfad, "{}");
|
||||
File.SetUnixFileMode(pfad, NurBesitzer | UnixFileMode.GroupRead | UnixFileMode.OtherRead);
|
||||
var path = Path.Combine(_dir, "InstanceSettings.json");
|
||||
File.WriteAllText(path, "{}");
|
||||
File.SetUnixFileMode(path, OwnerOnly | UnixFileMode.GroupRead | UnixFileMode.OtherRead);
|
||||
|
||||
AtomicFile.WriteAllText(pfad, "{\"a\":1}");
|
||||
AtomicFile.WriteAllText(path, "{\"a\":1}");
|
||||
|
||||
File.GetUnixFileMode(pfad).ShouldBe(NurBesitzer);
|
||||
File.GetUnixFileMode(path).ShouldBe(OwnerOnly);
|
||||
}
|
||||
|
||||
[LinuxFact]
|
||||
[System.Runtime.Versioning.SupportedOSPlatform("linux")]
|
||||
public void AtomicFile_legt_neue_Dateien_nur_fuer_den_Besitzer_an()
|
||||
public void AtomicFile_creates_new_files_owner_only()
|
||||
{
|
||||
var pfad = Path.Combine(_dir, "neu.json");
|
||||
var path = Path.Combine(_dir, "neu.json");
|
||||
|
||||
AtomicFile.WriteAllText(pfad, "{}");
|
||||
AtomicFile.WriteAllText(path, "{}");
|
||||
|
||||
File.GetUnixFileMode(pfad).ShouldBe(NurBesitzer);
|
||||
File.GetUnixFileMode(path).ShouldBe(OwnerOnly);
|
||||
}
|
||||
|
||||
[LinuxFact]
|
||||
[System.Runtime.Versioning.SupportedOSPlatform("linux")]
|
||||
public void OpenAppend_legt_neue_Dateien_nur_fuer_den_Besitzer_an()
|
||||
public void OpenAppend_creates_new_files_owner_only()
|
||||
{
|
||||
var pfad = Path.Combine(_dir, "protokoll.log");
|
||||
var path = Path.Combine(_dir, "protokoll.log");
|
||||
|
||||
using (var stream = OwnerOnlyFile.OpenAppend(pfad))
|
||||
using (var stream = OwnerOnlyFile.OpenAppend(path))
|
||||
stream.WriteByte((byte)'x');
|
||||
|
||||
File.GetUnixFileMode(pfad).ShouldBe(NurBesitzer);
|
||||
File.GetUnixFileMode(path).ShouldBe(OwnerOnly);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OpenAppend_haengt_an_statt_zu_ueberschreiben()
|
||||
public void OpenAppend_appends_instead_of_overwriting()
|
||||
{
|
||||
var pfad = Path.Combine(_dir, "anhang.txt");
|
||||
var path = Path.Combine(_dir, "anhang.txt");
|
||||
|
||||
foreach (var teil in new[] { "eins", "zwei" })
|
||||
foreach (var part in new[] { "eins", "zwei" })
|
||||
{
|
||||
using var stream = OwnerOnlyFile.OpenAppend(pfad);
|
||||
using var stream = OwnerOnlyFile.OpenAppend(path);
|
||||
using var writer = new StreamWriter(stream);
|
||||
writer.Write(teil);
|
||||
writer.Write(part);
|
||||
}
|
||||
|
||||
File.ReadAllText(pfad).ShouldBe("einszwei");
|
||||
File.ReadAllText(path).ShouldBe("einszwei");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user