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>
89 lines
2.9 KiB
C#
89 lines
2.9 KiB
C#
using ClawdDotNet.Core.Scheduling;
|
|
using Shouldly;
|
|
|
|
namespace ClawdDotNet.Core.Tests.Scheduling;
|
|
|
|
/// <summary>
|
|
/// Time zones are named differently on Windows and Linux. Task files travel between
|
|
/// the two — so each side must be able to interpret the other's spelling.
|
|
///
|
|
/// The tests deliberately run on both platforms with the same expectations: exactly
|
|
/// that is the property we need.
|
|
/// </summary>
|
|
public sealed class TimeZonesTests
|
|
{
|
|
[Theory]
|
|
[InlineData("Europe/Berlin")]
|
|
[InlineData("W. Europe Standard Time")]
|
|
[InlineData("America/New_York")]
|
|
[InlineData("Eastern Standard Time")]
|
|
[InlineData("UTC")]
|
|
public void Beide_Schreibweisen_sind_aufloesbar(string id)
|
|
{
|
|
TimeZones.TryResolve(id).ShouldNotBeNull();
|
|
TimeZones.IsKnown(id).ShouldBeTrue();
|
|
}
|
|
|
|
[Fact]
|
|
public void Beide_Schreibweisen_meinen_dieselbe_Zone()
|
|
{
|
|
var iana = TimeZones.TryResolve("Europe/Berlin");
|
|
var windows = TimeZones.TryResolve("W. Europe Standard Time");
|
|
|
|
var sommer = new DateTime(2026, 7, 31, 12, 0, 0, DateTimeKind.Utc);
|
|
|
|
iana!.GetUtcOffset(sommer).ShouldBe(windows!.GetUtcOffset(sommer));
|
|
iana.GetUtcOffset(sommer).ShouldBe(TimeSpan.FromHours(2)); // CEST
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("Phantasie/Ort")]
|
|
[InlineData("Nicht Existierende Standard Time")]
|
|
[InlineData("völliger Unsinn")]
|
|
public void Unbekannte_Kennungen_werden_gemeldet_statt_geraten(string id)
|
|
{
|
|
TimeZones.TryResolve(id).ShouldBeNull();
|
|
TimeZones.IsKnown(id).ShouldBeFalse();
|
|
}
|
|
|
|
[Fact]
|
|
public void Leer_gilt_als_gueltig_denn_es_bedeutet_keine_Angabe()
|
|
{
|
|
TimeZones.IsKnown("").ShouldBeTrue();
|
|
TimeZones.IsKnown(null).ShouldBeTrue();
|
|
TimeZones.IsKnown(" ").ShouldBeTrue();
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("W. Europe Standard Time", "Europe/Berlin")]
|
|
[InlineData("Europe/Berlin", "Europe/Berlin")]
|
|
[InlineData("", "")]
|
|
public void Normalisieren_ergibt_die_IANA_Schreibweise(string input, string expected)
|
|
{
|
|
TimeZones.ToIana(input).ShouldBe(expected);
|
|
}
|
|
|
|
[Fact]
|
|
public void Eine_nicht_umsetzbare_Kennung_bleibt_unveraendert()
|
|
{
|
|
// Falsifying would be worse than passing through — that way, in case of doubt,
|
|
// what originally stood there stays visible.
|
|
TimeZones.ToIana("Phantasie Standard Time").ShouldBe("Phantasie Standard Time");
|
|
}
|
|
|
|
[Fact]
|
|
public void Die_lokale_Zone_wird_in_IANA_Schreibweise_geliefert()
|
|
{
|
|
var local = TimeZones.LocalIanaId;
|
|
|
|
local.ShouldNotBeNullOrWhiteSpace();
|
|
TimeZones.IsKnown(local).ShouldBeTrue();
|
|
|
|
// The actual point: what comes out here is written into task files
|
|
// and must be readable on the other platform. IANA identifiers contain a
|
|
// slash, Windows identifiers never — UTC is the exception with neither.
|
|
if (local != "UTC")
|
|
local.ShouldContain("/");
|
|
}
|
|
}
|