Wetterdienst: Erweitert
This commit is contained in:
@@ -41,6 +41,27 @@ public sealed class SchoolDayWeatherSummaryTests
|
||||
Assert.Equal(SchoolDayWeatherKind.Sunny, summary!.Kind);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void From_VerwendetFuerKennzahlenNurAchtBisSechzehnUhr()
|
||||
{
|
||||
var snapshot = Snapshot(
|
||||
Hour(7, temperature: 5, rain: 3, probability: 95, sunshineMinutes: 0),
|
||||
Hour(8, temperature: 12, probability: 20, sunshineMinutes: 30),
|
||||
Hour(16, temperature: 17, probability: 65, sunshineMinutes: 45),
|
||||
Hour(17, temperature: 25, rain: 4, probability: 99, sunshineMinutes: 60));
|
||||
|
||||
var summary = SchoolDayWeatherSummary.From(snapshot, Day);
|
||||
|
||||
Assert.Equal(12, summary!.MinTemperatureC);
|
||||
Assert.Equal(17, summary.MaxTemperatureC);
|
||||
Assert.Equal(0, summary.PrecipitationMm);
|
||||
Assert.Equal(65, summary.MaxHourlyPrecipitationProbabilityPercent);
|
||||
Assert.Equal(1.3, summary.SunshineDurationHours);
|
||||
Assert.Contains("08–16 Uhr", summary.Tooltip);
|
||||
Assert.Contains("Regenwahrscheinlichkeit: bis 65 % (stündlich)", summary.Tooltip);
|
||||
Assert.Contains($"Sonnenschein: {summary.SunshineDurationHours:0.#} h", summary.Tooltip);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void From_AmtlicheGewitterwarnung_PraegtSymbolUndTooltip()
|
||||
{
|
||||
@@ -93,10 +114,12 @@ public sealed class SchoolDayWeatherSummaryTests
|
||||
};
|
||||
|
||||
private static WeatherForecastHour Hour(int hour, int? code = 0, double? temperature = 20,
|
||||
double? rain = 0, double? gust = 20, double? cloud = 20) => new()
|
||||
double? rain = 0, double? gust = 20, double? cloud = 20,
|
||||
double? probability = null, double? sunshineMinutes = null) => new()
|
||||
{
|
||||
ValidAt = Day.ToDateTime(new TimeOnly(hour, 0)), WeatherCode = code,
|
||||
TemperatureC = temperature, PrecipitationMm = rain, WindGustKmh = gust,
|
||||
CloudCoverPercent = cloud,
|
||||
CloudCoverPercent = cloud, PrecipitationProbabilityPercent = probability,
|
||||
SunshineDurationMinutes = sunshineMinutes,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user