style: apply CSharpier formatting to all C# sources
Repo-wide sweep with the pinned CSharpier 1.3.0 tool. Whitespace and line-wrapping only; OpenNest.Engine.Tests (109) and OpenNest.IO.Tests pass after reformat, full solution builds 0 errors. Added .csharpierignore so csproj/config XML keeps its existing layout (CSharpier's XML wrapping churns attributes with zero benefit). Formatting is now enforceable: dotnet csharpier check . passes.
This commit is contained in:
@@ -10,13 +10,21 @@ public class NestJobCancellationTests
|
||||
{
|
||||
using var cancellation = new CancellationTokenSource();
|
||||
cancellation.Cancel();
|
||||
var nester = new CancellableNester(_ => new PlateCandidate(Array.Empty<NestJobPlacement>()));
|
||||
var part = new NestJobPart("part", PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(4, 3)), 1);
|
||||
var nester = new CancellableNester(_ => new PlateCandidate(
|
||||
Array.Empty<NestJobPlacement>()
|
||||
));
|
||||
var part = new NestJobPart(
|
||||
"part",
|
||||
PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(4, 3)),
|
||||
1
|
||||
);
|
||||
var sourceGeometry = part.Geometry.Motions.ToArray();
|
||||
var stock = new NestPlateStock("stock", new Size(20, 30), 1);
|
||||
var job = new NestJob(new[] { part }, new[] { stock });
|
||||
|
||||
Assert.Throws<OperationCanceledException>(() => new NestJobRunner(_ => nester).Solve(job, token: cancellation.Token));
|
||||
Assert.Throws<OperationCanceledException>(() =>
|
||||
new NestJobRunner(_ => nester).Solve(job, token: cancellation.Token)
|
||||
);
|
||||
|
||||
Assert.Equal(0, nester.Calls);
|
||||
Assert.Equal(sourceGeometry, job.Parts[0].Geometry.Motions);
|
||||
@@ -29,19 +37,30 @@ public class NestJobCancellationTests
|
||||
{
|
||||
using var cancellation = new CancellationTokenSource();
|
||||
var reports = new List<NestJobProgress>();
|
||||
var part = new NestJobPart("part", PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(4, 3)), 1);
|
||||
var part = new NestJobPart(
|
||||
"part",
|
||||
PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(4, 3)),
|
||||
1
|
||||
);
|
||||
var sourceGeometry = part.Geometry.Motions.ToArray();
|
||||
var stock = new NestPlateStock("stock", new Size(20, 30), 1);
|
||||
var job = new NestJob(new[] { part }, new[] { stock });
|
||||
var nester = new CancellableNester((_, token) =>
|
||||
{
|
||||
cancellation.Cancel();
|
||||
token.ThrowIfCancellationRequested();
|
||||
return new PlateCandidate(Array.Empty<NestJobPlacement>());
|
||||
});
|
||||
var nester = new CancellableNester(
|
||||
(_, token) =>
|
||||
{
|
||||
cancellation.Cancel();
|
||||
token.ThrowIfCancellationRequested();
|
||||
return new PlateCandidate(Array.Empty<NestJobPlacement>());
|
||||
}
|
||||
);
|
||||
|
||||
Assert.Throws<OperationCanceledException>(() => new NestJobRunner(_ => nester)
|
||||
.Solve(job, new InlineProgress(reports.Add), cancellation.Token));
|
||||
Assert.Throws<OperationCanceledException>(() =>
|
||||
new NestJobRunner(_ => nester).Solve(
|
||||
job,
|
||||
new InlineProgress(reports.Add),
|
||||
cancellation.Token
|
||||
)
|
||||
);
|
||||
|
||||
Assert.Equal(1, nester.Calls);
|
||||
Assert.DoesNotContain(reports, report => report.Stage == NestJobStage.PlateCommitted);
|
||||
@@ -54,9 +73,18 @@ public class NestJobCancellationTests
|
||||
public void LegacyProgressIsWrappedWithCurrentCandidateContext()
|
||||
{
|
||||
var reports = new List<NestJobProgress>();
|
||||
var part = new NestJobPart("part", PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(4, 3)), 1);
|
||||
var job = new NestJob(new[] { part }, new[] { new NestPlateStock("stock", new Size(20, 30), 1) });
|
||||
var runner = new NestJobRunner(_ => new LegacyPlateNesterAdapter(plate => new ReportingEngine(plate)));
|
||||
var part = new NestJobPart(
|
||||
"part",
|
||||
PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(4, 3)),
|
||||
1
|
||||
);
|
||||
var job = new NestJob(
|
||||
new[] { part },
|
||||
new[] { new NestPlateStock("stock", new Size(20, 30), 1) }
|
||||
);
|
||||
var runner = new NestJobRunner(_ => new LegacyPlateNesterAdapter(
|
||||
plate => new ReportingEngine(plate)
|
||||
));
|
||||
|
||||
var result = runner.Solve(job, new InlineProgress(reports.Add));
|
||||
|
||||
@@ -84,15 +112,20 @@ public class NestJobCancellationTests
|
||||
this.place = (request, _) => place(request);
|
||||
}
|
||||
|
||||
public CancellableNester(Func<PlatePlacementRequest, CancellationToken, PlateCandidate> place)
|
||||
public CancellableNester(
|
||||
Func<PlatePlacementRequest, CancellationToken, PlateCandidate> place
|
||||
)
|
||||
{
|
||||
this.place = place;
|
||||
}
|
||||
|
||||
public int Calls { get; private set; }
|
||||
|
||||
public PlateCandidate Place(PlatePlacementRequest request, IProgress<NestJobProgress>? progress = null,
|
||||
CancellationToken token = default)
|
||||
public PlateCandidate Place(
|
||||
PlatePlacementRequest request,
|
||||
IProgress<NestJobProgress>? progress = null,
|
||||
CancellationToken token = default
|
||||
)
|
||||
{
|
||||
Calls++;
|
||||
return place(request, token);
|
||||
@@ -104,8 +137,11 @@ public class NestJobCancellationTests
|
||||
public override string Name => "reporting";
|
||||
public override string Description => "reports progress";
|
||||
|
||||
public override List<Part> Nest(List<NestItem> items, IProgress<NestProgress>? progress,
|
||||
CancellationToken token)
|
||||
public override List<Part> Nest(
|
||||
List<NestItem> items,
|
||||
IProgress<NestProgress>? progress,
|
||||
CancellationToken token
|
||||
)
|
||||
{
|
||||
progress?.Report(new NestProgress { Description = "legacy detail" });
|
||||
return new List<Part>();
|
||||
|
||||
Reference in New Issue
Block a user