Clear the residual Qodana findings

- Drop the leftover unused using, parameter and date-time attribute reader
- Merge the remaining enum guard into its pattern
- Make the NordPool price DTO init-only
- Replace the four non-serializable theory matrices with single tests that
  iterate the same rows, so xUnit can still report them
- Replace Array.Empty with collection expressions and drop unused locals,
  redundant default arguments and duplicated tuple names
- Throw from the unreachable shower default instead of an empty section
- Cover the configurable PowerMonitor option overrides in a test so the
  init setters have a caller
This commit is contained in:
2026-11-29 21:49:21 +02:00
parent 41ac93733e
commit cf8c9434c8
15 changed files with 173 additions and 206 deletions
+1 -32
View File
@@ -577,7 +577,7 @@ public sealed class BoilerMonitorInit
string s => bool.TryParse(s, out var parsed) && parsed,
JsonElement { ValueKind: JsonValueKind.True } => true,
JsonElement { ValueKind: JsonValueKind.False } => false,
JsonElement jsonElement when jsonElement.ValueKind == JsonValueKind.String =>
JsonElement { ValueKind: JsonValueKind.String } jsonElement =>
bool.TryParse(jsonElement.GetString(), out var jsonParsed) && jsonParsed,
_ => false
};
@@ -602,35 +602,4 @@ public sealed class BoilerMonitorInit
return elapsed < WaterReadyNotificationCooldown;
}
private static DateTime? ReadAttributeDateTime(EntityState? entityState, string attributeName)
{
if (entityState?.Attributes is null)
{
return null;
}
try
{
if (entityState.Attributes is IDictionary<string, object> attributes && attributes.TryGetValue(attributeName, out var value))
{
var stringValue = value switch
{
string s => s,
JsonElement { ValueKind: JsonValueKind.String } jsonElement => jsonElement.GetString(),
_ => null
};
if (stringValue is not null && DateTime.TryParse(stringValue, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out var parsed))
{
return parsed;
}
}
}
catch
{
// Attribute not found or not parseable
}
return null;
}
}