Move fill algorithms to OpenNest.Engine.Fill namespace: FillLinear, FillExtents, PairFiller, ShrinkFiller, Compactor, RemnantFiller, RemnantFinder, FillScore, Pattern, PatternTiler, PartBoundary, RotationAnalysis, AngleCandidateBuilder, and AccumulatingProgress. Move strategy layer to OpenNest.Engine.Strategies namespace: IFillStrategy, FillContext, FillStrategyRegistry, FillHelpers, and all built-in strategy implementations. Add using directives to all consuming files across Engine, UI, MCP, and Tests projects. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
54 lines
1.7 KiB
C#
54 lines
1.7 KiB
C#
using OpenNest.Engine.Fill;
|
|
|
|
namespace OpenNest.Tests;
|
|
|
|
public class AccumulatingProgressTests
|
|
{
|
|
private class CapturingProgress : IProgress<NestProgress>
|
|
{
|
|
public NestProgress Last { get; private set; }
|
|
public void Report(NestProgress value) => Last = value;
|
|
}
|
|
|
|
[Fact]
|
|
public void Report_PrependsPreviousParts()
|
|
{
|
|
var inner = new CapturingProgress();
|
|
var previous = new List<Part> { TestHelpers.MakePartAt(0, 0, 10) };
|
|
var accumulating = new AccumulatingProgress(inner, previous);
|
|
|
|
var newParts = new List<Part> { TestHelpers.MakePartAt(20, 0, 10) };
|
|
accumulating.Report(new NestProgress { BestParts = newParts, BestPartCount = 1 });
|
|
|
|
Assert.NotNull(inner.Last);
|
|
Assert.Equal(2, inner.Last.BestParts.Count);
|
|
Assert.Equal(2, inner.Last.BestPartCount);
|
|
}
|
|
|
|
[Fact]
|
|
public void Report_NoPreviousParts_PassesThrough()
|
|
{
|
|
var inner = new CapturingProgress();
|
|
var accumulating = new AccumulatingProgress(inner, new List<Part>());
|
|
|
|
var newParts = new List<Part> { TestHelpers.MakePartAt(0, 0, 10) };
|
|
accumulating.Report(new NestProgress { BestParts = newParts, BestPartCount = 1 });
|
|
|
|
Assert.NotNull(inner.Last);
|
|
Assert.Single(inner.Last.BestParts);
|
|
}
|
|
|
|
[Fact]
|
|
public void Report_NullBestParts_PassesThrough()
|
|
{
|
|
var inner = new CapturingProgress();
|
|
var previous = new List<Part> { TestHelpers.MakePartAt(0, 0, 10) };
|
|
var accumulating = new AccumulatingProgress(inner, previous);
|
|
|
|
accumulating.Report(new NestProgress { BestParts = null });
|
|
|
|
Assert.NotNull(inner.Last);
|
|
Assert.Null(inner.Last.BestParts);
|
|
}
|
|
}
|