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:
aj
2026-09-20 16:41:50 -04:00
parent 8e6fa677fb
commit aec0523062
476 changed files with 16592 additions and 7800 deletions
@@ -12,7 +12,12 @@ public class SplitDxfWriterEtchLayerTests
public void Write_DrawingWithUpBend_EtchLinesHaveEtchLayer()
{
// Create a simple rectangular drawing with an up bend
var drawing = new RectangleShape { Name = "TEST", Length = 100, Width = 50 }.GetDrawing();
var drawing = new RectangleShape
{
Name = "TEST",
Length = 100,
Width = 50,
}.GetDrawing();
drawing.Bends = new List<Bend>
{
new Bend
@@ -22,8 +27,8 @@ public class SplitDxfWriterEtchLayerTests
Direction = BendDirection.Up,
Angle = 90,
Radius = 0.06,
NoteText = "UP 90° R0.06"
}
NoteText = "UP 90° R0.06",
},
};
var tempPath = Path.Combine(Path.GetTempPath(), $"etch_layer_test_{Guid.NewGuid()}.dxf");
@@ -50,8 +55,9 @@ public class SplitDxfWriterEtchLayerTests
// Check if this line is an etch mark (short, near the bend Y=25)
var midY = (line.StartPoint.Y + line.EndPoint.Y) / 2;
var length = System.Math.Sqrt(
System.Math.Pow(line.EndPoint.X - line.StartPoint.X, 2) +
System.Math.Pow(line.EndPoint.Y - line.StartPoint.Y, 2));
System.Math.Pow(line.EndPoint.X - line.StartPoint.X, 2)
+ System.Math.Pow(line.EndPoint.Y - line.StartPoint.Y, 2)
);
if (System.Math.Abs(midY - 25) < 0.1 && length <= 1.5 && layerName != "BEND")
{
@@ -61,9 +67,11 @@ public class SplitDxfWriterEtchLayerTests
}
// Should have etch lines (up bend with length 100 > 3*EtchLength, so 2 etch dashes)
Assert.True(etchEntities.Count >= 2,
$"Expected at least 2 etch lines, found {etchEntities.Count}. " +
$"All entities: {string.Join(", ", allEntities.Select(e => $"{e.Type}@{e.LayerName}"))}");
Assert.True(
etchEntities.Count >= 2,
$"Expected at least 2 etch lines, found {etchEntities.Count}. "
+ $"All entities: {string.Join(", ", allEntities.Select(e => $"{e.Type}@{e.LayerName}"))}"
);
// ALL etch lines should be on the ETCH layer, not layer 0
foreach (var etch in etchEntities)
@@ -83,7 +91,12 @@ public class SplitDxfWriterEtchLayerTests
public void Write_SplitDrawingWithUpBend_EtchLinesHaveEtchLayer()
{
// Create a drawing, split it, then verify etch layers in the split DXFs
var drawing = new RectangleShape { Name = "TEST", Length = 100, Width = 50 }.GetDrawing();
var drawing = new RectangleShape
{
Name = "TEST",
Length = 100,
Width = 50,
}.GetDrawing();
drawing.Bends = new List<Bend>
{
new Bend
@@ -93,8 +106,8 @@ public class SplitDxfWriterEtchLayerTests
Direction = BendDirection.Up,
Angle = 90,
Radius = 0.06,
NoteText = "UP 90° R0.06"
}
NoteText = "UP 90° R0.06",
},
};
var splitLines = new List<SplitLine> { new SplitLine(50.0, CutOffAxis.Vertical) };
@@ -109,7 +122,10 @@ public class SplitDxfWriterEtchLayerTests
Assert.NotNull(splitDrawing.Bends);
Assert.True(splitDrawing.Bends.Count > 0, $"{splitDrawing.Name} should have bends");
var tempPath = Path.Combine(Path.GetTempPath(), $"split_etch_test_{splitDrawing.Name}_{Guid.NewGuid()}.dxf");
var tempPath = Path.Combine(
Path.GetTempPath(),
$"split_etch_test_{splitDrawing.Name}_{Guid.NewGuid()}.dxf"
);
try
{
var writer = new SplitDxfWriter();
@@ -135,15 +151,19 @@ public class SplitDxfWriterEtchLayerTests
}
// Should have etch entities
Assert.True(etchLayerEntities.Count > 0,
$"{splitDrawing.Name}: No entities on ETCH layer. " +
$"All: {string.Join(", ", entitySummary)}");
Assert.True(
etchLayerEntities.Count > 0,
$"{splitDrawing.Name}: No entities on ETCH layer. "
+ $"All: {string.Join(", ", entitySummary)}"
);
// No entities should be on layer 0
Assert.True(layer0Entities.Count == 0,
$"{splitDrawing.Name}: {layer0Entities.Count} entities on layer 0 " +
$"(expected all on CUT/BEND/ETCH). " +
$"All: {string.Join(", ", entitySummary)}");
Assert.True(
layer0Entities.Count == 0,
$"{splitDrawing.Name}: {layer0Entities.Count} entities on layer 0 "
+ $"(expected all on CUT/BEND/ETCH). "
+ $"All: {string.Join(", ", entitySummary)}"
);
}
finally
{
@@ -158,7 +178,12 @@ public class SplitDxfWriterEtchLayerTests
{
// After re-import, ETCH entities should be filtered (like BEND) since
// etch marks are generated from bends, not treated as cut geometry.
var drawing = new RectangleShape { Name = "TEST", Length = 100, Width = 50 }.GetDrawing();
var drawing = new RectangleShape
{
Name = "TEST",
Length = 100,
Width = 50,
}.GetDrawing();
drawing.Bends = new List<Bend>
{
new Bend
@@ -168,8 +193,8 @@ public class SplitDxfWriterEtchLayerTests
Direction = BendDirection.Up,
Angle = 90,
Radius = 0.06,
NoteText = "UP 90° R0.06"
}
NoteText = "UP 90° R0.06",
},
};
var splitLines = new List<SplitLine> { new SplitLine(50.0, CutOffAxis.Vertical) };
@@ -178,7 +203,10 @@ public class SplitDxfWriterEtchLayerTests
foreach (var splitDrawing in results)
{
var tempPath = Path.Combine(Path.GetTempPath(), $"reimport_etch_test_{splitDrawing.Name}_{Guid.NewGuid()}.dxf");
var tempPath = Path.Combine(
Path.GetTempPath(),
$"reimport_etch_test_{splitDrawing.Name}_{Guid.NewGuid()}.dxf"
);
try
{
var writer = new SplitDxfWriter();
@@ -188,25 +216,40 @@ public class SplitDxfWriterEtchLayerTests
var result = Dxf.Import(tempPath);
// ETCH entities should be filtered during import (like BEND)
var etchEntities = result.Entities
.Where(e => string.Equals(e.Layer?.Name, "ETCH", StringComparison.OrdinalIgnoreCase))
var etchEntities = result
.Entities.Where(e =>
string.Equals(e.Layer?.Name, "ETCH", StringComparison.OrdinalIgnoreCase)
)
.ToList();
var layer0Entities = result.Entities
.Where(e => string.Equals(e.Layer?.Name, "0", StringComparison.OrdinalIgnoreCase))
var layer0Entities = result
.Entities.Where(e =>
string.Equals(e.Layer?.Name, "0", StringComparison.OrdinalIgnoreCase)
)
.ToList();
Assert.True(etchEntities.Count == 0,
$"{splitDrawing.Name}: ETCH entities should be filtered during import, found {etchEntities.Count}");
Assert.True(
etchEntities.Count == 0,
$"{splitDrawing.Name}: ETCH entities should be filtered during import, found {etchEntities.Count}"
);
Assert.True(layer0Entities.Count == 0,
$"{splitDrawing.Name}: {layer0Entities.Count} entities on layer 0 after re-import");
Assert.True(
layer0Entities.Count == 0,
$"{splitDrawing.Name}: {layer0Entities.Count} entities on layer 0 after re-import"
);
// All imported entities should be on CUT layer (cut geometry only)
Assert.True(result.Entities.Count > 0, $"{splitDrawing.Name}: Should have cut geometry");
Assert.True(result.Entities.All(e => string.Equals(e.Layer?.Name, "CUT", StringComparison.OrdinalIgnoreCase)),
$"{splitDrawing.Name}: All imported entities should be on CUT layer. " +
$"Found: {string.Join(", ", result.Entities.Select(e => e.Layer?.Name ?? "(null)").Distinct())}");
Assert.True(
result.Entities.Count > 0,
$"{splitDrawing.Name}: Should have cut geometry"
);
Assert.True(
result.Entities.All(e =>
string.Equals(e.Layer?.Name, "CUT", StringComparison.OrdinalIgnoreCase)
),
$"{splitDrawing.Name}: All imported entities should be on CUT layer. "
+ $"Found: {string.Join(", ", result.Entities.Select(e => e.Layer?.Name ?? "(null)").Distinct())}"
);
}
finally
{