P1b: System.Drawing aus der Fachlogik entfernt
- TradeRowColoring liefert jetzt eine TradeRowTint-Kategorie (Loss/SmallWin/BigWin) statt einer System.Drawing.Color. Die Schwellenlogik bleibt getestet, die konkrete Farbe legt die UI fest (neu: Ui/TradeRowPalette.cs im CopyTrading-Modul). Bessere Schichtung und Voraussetzung dafuer, dass das Modul spaeter net8.0 wird. - TradeRowColoringTests prueft die Kategorie statt der Farbe (gleiche Abdeckung). - Models/DashboardRow.cs: verwaistes using System.Drawing entfernt. System.Drawing liegt damit ausschliesslich noch in UI-Ordnern - die Fachlogik in Core und Modulen ist frei davon. 442 Tests gruen, --smoke-ui gruen. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,27 +3,24 @@ using Xunit;
|
||||
|
||||
namespace PolyTrader.Tests
|
||||
{
|
||||
/// <summary>Sicherheitsnetz für die PnL-Zeilenfärbung (Slice 3): Schwellen -10/0/10.</summary>
|
||||
/// <summary>
|
||||
/// Sicherheitsnetz für die PnL-Zeileneinstufung (Slice 3): Schwellen 0 und 10 %.
|
||||
/// Prüft seit der Linux-Portierung die Kategorie statt der Farbe – die Schwellenlogik ist
|
||||
/// das Fachliche, die konkrete Farbe Sache der jeweiligen UI (siehe TradeRowPalette).
|
||||
/// </summary>
|
||||
public class TradeRowColoringTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(-0.01, "loss")]
|
||||
[InlineData(-25.0, "loss")]
|
||||
[InlineData(0.0, "small")] // Break-even = hellgrün (kein Verlust)
|
||||
[InlineData(5.0, "small")]
|
||||
[InlineData(10.0, "small")] // genau 10 % noch hellgrün
|
||||
[InlineData(10.01, "big")]
|
||||
[InlineData(80.0, "big")]
|
||||
public void Color_matches_threshold(double pct, string expected)
|
||||
[InlineData(-0.01, TradeRowTint.Loss)]
|
||||
[InlineData(-25.0, TradeRowTint.Loss)]
|
||||
[InlineData(0.0, TradeRowTint.SmallWin)] // Break-even = kein Verlust
|
||||
[InlineData(5.0, TradeRowTint.SmallWin)]
|
||||
[InlineData(10.0, TradeRowTint.SmallWin)] // genau 10 % noch kleiner Gewinn
|
||||
[InlineData(10.01, TradeRowTint.BigWin)]
|
||||
[InlineData(80.0, TradeRowTint.BigWin)]
|
||||
public void Tint_matches_threshold(double pct, TradeRowTint expected)
|
||||
{
|
||||
var c = TradeRowColoring.ForPnlPercent((decimal)pct);
|
||||
var want = expected switch
|
||||
{
|
||||
"loss" => TradeRowColoring.Loss,
|
||||
"big" => TradeRowColoring.BigWin,
|
||||
_ => TradeRowColoring.SmallWin
|
||||
};
|
||||
Assert.Equal(want, c);
|
||||
Assert.Equal(expected, TradeRowColoring.ForPnlPercent((decimal)pct));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user