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:
@@ -14,10 +14,10 @@ public class NestJobValidationTests
|
||||
program.LineTo(0, 3);
|
||||
program.LineTo(-4, 0);
|
||||
program.LineTo(0, -3);
|
||||
var job = new NestJob(new[]
|
||||
{
|
||||
new NestJobPart("part", PartGeometrySnapshot.FromProgram(program), 1)
|
||||
}, new[] { new NestPlateStock("stock", new Size(10, 10), 1) });
|
||||
var job = new NestJob(
|
||||
new[] { new NestJobPart("part", PartGeometrySnapshot.FromProgram(program), 1) },
|
||||
new[] { new NestPlateStock("stock", new Size(10, 10), 1) }
|
||||
);
|
||||
|
||||
var result = Solve(job, new NestJobPlacement("part", 0, 0, 0, 0));
|
||||
|
||||
@@ -28,13 +28,26 @@ public class NestJobValidationTests
|
||||
[Fact]
|
||||
public void CandidateInsideAnotherRequirementsHoleDoesNotOverlapMaterial()
|
||||
{
|
||||
var outer = new NestJobPart("outer", PartGeometrySnapshot.FromProgram(RectangleWithHole()), 1);
|
||||
var inner = new NestJobPart("inner", PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(2, 2)), 1);
|
||||
var job = new NestJob(new[] { outer, inner }, new[] { new NestPlateStock("stock", new Size(20, 20), 1) });
|
||||
var outer = new NestJobPart(
|
||||
"outer",
|
||||
PartGeometrySnapshot.FromProgram(RectangleWithHole()),
|
||||
1
|
||||
);
|
||||
var inner = new NestJobPart(
|
||||
"inner",
|
||||
PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(2, 2)),
|
||||
1
|
||||
);
|
||||
var job = new NestJob(
|
||||
new[] { outer, inner },
|
||||
new[] { new NestPlateStock("stock", new Size(20, 20), 1) }
|
||||
);
|
||||
|
||||
var result = Solve(job,
|
||||
var result = Solve(
|
||||
job,
|
||||
new NestJobPlacement("outer", 0, 0, 0, 0),
|
||||
new NestJobPlacement("inner", 0, 4, 4, 0));
|
||||
new NestJobPlacement("inner", 0, 4, 4, 0)
|
||||
);
|
||||
|
||||
Assert.Equal(NestJobStatus.Complete, result.Status);
|
||||
Assert.Single(result.Plates);
|
||||
@@ -44,12 +57,23 @@ public class NestJobValidationTests
|
||||
[Fact]
|
||||
public void SmallCornerOverlapIsRejected()
|
||||
{
|
||||
var part = new NestJobPart("part", PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(10, 10)), 2);
|
||||
var job = new NestJob(new[] { part }, new[] { new NestPlateStock("stock", new Size(20, 20), 1) });
|
||||
var part = new NestJobPart(
|
||||
"part",
|
||||
PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(10, 10)),
|
||||
2
|
||||
);
|
||||
var job = new NestJob(
|
||||
new[] { part },
|
||||
new[] { new NestPlateStock("stock", new Size(20, 20), 1) }
|
||||
);
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() => Solve(job,
|
||||
new NestJobPlacement("part", 0, 0, 0, 0),
|
||||
new NestJobPlacement("part", 1, 9, 9, 0)));
|
||||
Assert.Throws<InvalidOperationException>(() =>
|
||||
Solve(
|
||||
job,
|
||||
new NestJobPlacement("part", 0, 0, 0, 0),
|
||||
new NestJobPlacement("part", 1, 9, 9, 0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -57,12 +81,21 @@ public class NestJobValidationTests
|
||||
[InlineData(10.0, 10.0)]
|
||||
public void BoundaryContactWithZeroSpacingIsAccepted(double x, double y)
|
||||
{
|
||||
var part = new NestJobPart("part", PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(10, 10)), 2);
|
||||
var job = new NestJob(new[] { part }, new[] { new NestPlateStock("stock", new Size(20, 20), 1) });
|
||||
var part = new NestJobPart(
|
||||
"part",
|
||||
PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(10, 10)),
|
||||
2
|
||||
);
|
||||
var job = new NestJob(
|
||||
new[] { part },
|
||||
new[] { new NestPlateStock("stock", new Size(20, 20), 1) }
|
||||
);
|
||||
|
||||
var result = Solve(job,
|
||||
var result = Solve(
|
||||
job,
|
||||
new NestJobPlacement("part", 0, 0, 0, 0),
|
||||
new NestJobPlacement("part", 1, x, y, 0));
|
||||
new NestJobPlacement("part", 1, x, y, 0)
|
||||
);
|
||||
|
||||
Assert.Equal(NestJobStatus.Complete, result.Status);
|
||||
Assert.Equal(2, Assert.Single(result.Plates).Placements.Count);
|
||||
@@ -72,16 +105,24 @@ public class NestJobValidationTests
|
||||
public void UnknownOrOverproducingCandidateFailsBeforeCommitWithoutChangingInput()
|
||||
{
|
||||
var reports = new List<NestJobProgress>();
|
||||
var part = new NestJobPart("part", PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(2, 2)), 1);
|
||||
var part = new NestJobPart(
|
||||
"part",
|
||||
PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(2, 2)),
|
||||
1
|
||||
);
|
||||
var stock = new NestPlateStock("stock", new Size(20, 20), 1);
|
||||
var job = new NestJob(new[] { part }, new[] { stock });
|
||||
var runner = new NestJobRunner(_ => new CandidateNester(new[]
|
||||
{
|
||||
new NestJobPlacement("part", 0, 0, 0, 0),
|
||||
new NestJobPlacement("unknown", 0, 4, 0, 0)
|
||||
}));
|
||||
var runner = new NestJobRunner(_ => new CandidateNester(
|
||||
new[]
|
||||
{
|
||||
new NestJobPlacement("part", 0, 0, 0, 0),
|
||||
new NestJobPlacement("unknown", 0, 4, 0, 0),
|
||||
}
|
||||
));
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() => runner.Solve(job, new InlineProgress(reports.Add)));
|
||||
Assert.Throws<InvalidOperationException>(() =>
|
||||
runner.Solve(job, new InlineProgress(reports.Add))
|
||||
);
|
||||
|
||||
Assert.Equal(1, job.Parts[0].Quantity);
|
||||
Assert.Equal(1, job.Plates[0].Quantity);
|
||||
@@ -91,12 +132,23 @@ public class NestJobValidationTests
|
||||
[Fact]
|
||||
public void CandidateThatOverproducesIsRejectedRatherThanClamped()
|
||||
{
|
||||
var part = new NestJobPart("part", PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(2, 2)), 1);
|
||||
var job = new NestJob(new[] { part }, new[] { new NestPlateStock("stock", new Size(20, 20), 1) });
|
||||
var part = new NestJobPart(
|
||||
"part",
|
||||
PartGeometrySnapshot.FromProgram(TestDrawingFactory.Rectangle(2, 2)),
|
||||
1
|
||||
);
|
||||
var job = new NestJob(
|
||||
new[] { part },
|
||||
new[] { new NestPlateStock("stock", new Size(20, 20), 1) }
|
||||
);
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() => Solve(job,
|
||||
new NestJobPlacement("part", 0, 0, 0, 0),
|
||||
new NestJobPlacement("part", 1, 4, 0, 0)));
|
||||
Assert.Throws<InvalidOperationException>(() =>
|
||||
Solve(
|
||||
job,
|
||||
new NestJobPlacement("part", 0, 0, 0, 0),
|
||||
new NestJobPlacement("part", 1, 4, 0, 0)
|
||||
)
|
||||
);
|
||||
|
||||
Assert.Equal(1, job.Parts[0].Quantity);
|
||||
Assert.Equal(1, job.Plates[0].Quantity);
|
||||
@@ -110,14 +162,20 @@ public class NestJobValidationTests
|
||||
var program = new Program();
|
||||
program.MoveTo(0, 0);
|
||||
program.LineTo(4, 0);
|
||||
if (zeroLength) program.LineTo(4, 0);
|
||||
if (zeroLength)
|
||||
program.LineTo(4, 0);
|
||||
program.LineTo(4, 3);
|
||||
program.LineTo(0, 3);
|
||||
if (zeroLength) program.LineTo(0, 0);
|
||||
var job = new NestJob(new[] { new NestJobPart("part", PartGeometrySnapshot.FromProgram(program), 1) },
|
||||
new[] { new NestPlateStock("stock", new Size(20, 20), 1) });
|
||||
if (zeroLength)
|
||||
program.LineTo(0, 0);
|
||||
var job = new NestJob(
|
||||
new[] { new NestJobPart("part", PartGeometrySnapshot.FromProgram(program), 1) },
|
||||
new[] { new NestPlateStock("stock", new Size(20, 20), 1) }
|
||||
);
|
||||
|
||||
Assert.Throws<ArgumentException>(() => new NestJobRunner(_ => new CandidateNester(Array.Empty<NestJobPlacement>())).Solve(job));
|
||||
Assert.Throws<ArgumentException>(() =>
|
||||
new NestJobRunner(_ => new CandidateNester(Array.Empty<NestJobPlacement>())).Solve(job)
|
||||
);
|
||||
}
|
||||
|
||||
private static NestJobResult Solve(NestJob job, params NestJobPlacement[] placements) =>
|
||||
@@ -136,8 +194,11 @@ public class NestJobValidationTests
|
||||
|
||||
private sealed class CandidateNester(IEnumerable<NestJobPlacement> placements) : IPlateNester
|
||||
{
|
||||
public PlateCandidate Place(PlatePlacementRequest request, IProgress<NestJobProgress>? progress = null,
|
||||
CancellationToken token = default) => new(placements);
|
||||
public PlateCandidate Place(
|
||||
PlatePlacementRequest request,
|
||||
IProgress<NestJobProgress>? progress = null,
|
||||
CancellationToken token = default
|
||||
) => new(placements);
|
||||
}
|
||||
|
||||
private sealed class InlineProgress(Action<NestJobProgress> report) : IProgress<NestJobProgress>
|
||||
|
||||
Reference in New Issue
Block a user