Skip to content

Commit ebe1bb2

Browse files
committed
coverage: close v1.11.0 90/90 gate — 2 new fluent-API tests (Axes/FigureBuilder configure branch) + Enum.Parse swap in ChartSerializer
1 parent 11436e7 commit ebe1bb2

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

Src/MatPlotLibNet/Serialization/ChartSerializer.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -639,9 +639,8 @@ internal static RelativeRotationSeries CreateRelativeRotation(Axes axes, SeriesD
639639
var s = axes.RelativeRotation(assetCloses, benchmarkCloses, labels);
640640
if (dto.ColorMapName is not null)
641641
s.ColorMap = Styling.ColorMaps.ColorMapRegistry.Get(dto.ColorMapName);
642-
if (dto.RrgFormula is not null
643-
&& Enum.TryParse<Models.Series.RrgFormula>(dto.RrgFormula, true, out var formula))
644-
s.Formula = formula;
642+
if (dto.RrgFormula is not null)
643+
s.Formula = Enum.Parse<Models.Series.RrgFormula>(dto.RrgFormula, ignoreCase: true);
645644
if (dto.RrgShortPeriod.HasValue) s.ShortPeriod = dto.RrgShortPeriod.Value;
646645
if (dto.RrgLongPeriod.HasValue) s.LongPeriod = dto.RrgLongPeriod.Value;
647646
if (dto.RrgMomentumLookback.HasValue) s.MomentumLookback = dto.RrgMomentumLookback.Value;

Tst/MatPlotLibNet/Rendering/RelativeRotationRenderTests.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,29 @@ public void AllNaNTail_DoesNotCrash()
168168
Assert.Contains("<svg", svg);
169169
Assert.DoesNotContain("<circle ", svg); // no heads drawn
170170
}
171+
172+
// ── Fluent API coverage ────────────────────────────────────────────────────
173+
174+
[Fact]
175+
public void Axes_RelativeRotation_WithConfigure_InvokesCallback()
176+
{
177+
// Directly call Axes.RelativeRotation with a non-null configure to cover
178+
// the configure?.Invoke(series) non-null branch (unreachable via AxesBuilder).
179+
var figure = Plt.Create().AddSubPlot(1, 1, 1, _ => { }).Build();
180+
var axes = figure.SubPlots[0];
181+
var s = axes.RelativeRotation(
182+
[Rising(60), Flat(60, 95)], Flat(60), ["ETH", "BNB"],
183+
configure: series => series.Formula = RrgFormula.ZScore);
184+
Assert.Equal(RrgFormula.ZScore, s.Formula);
185+
}
186+
187+
[Fact]
188+
public void FigureBuilder_RelativeRotation_BuildsWithoutException()
189+
{
190+
// Exercises FigureBuilder.RelativeRotation so the method body is line-covered.
191+
var figure = Plt.Create()
192+
.RelativeRotation([Rising(60)], Flat(60), ["ETH"])
193+
.Build();
194+
Assert.NotNull(figure);
195+
}
171196
}

0 commit comments

Comments
 (0)