CadParamPluging/Tests/ShaftBreakCenterLineTests.cs

37 lines
1.2 KiB
C#

using System;
using System.IO;
public static class ShaftBreakCenterLineTests
{
public static int Main()
{
try
{
SquareShaftCenterLineSkipsBreakGap();
Console.WriteLine("Shaft break centerline tests passed.");
return 0;
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
return 1;
}
}
private static void SquareShaftCenterLineSkipsBreakGap()
{
var sourcePath = Path.Combine("Cad", "ShaftRawFreeForgeSquareShaftDrawer.cs");
var source = File.ReadAllText(sourcePath);
if (source.Contains("var centerLine = new Line(new Point3d(ox - 10, clY, 0), new Point3d(ox + S1 + 10, clY, 0));"))
{
throw new InvalidOperationException(sourcePath + ": square shaft centerline must not pass through the break gap.");
}
if (!source.Contains("DrawHorizontalCenterLine(ctx, clY, ox, ox + S1, needBreakLines, xBreak, lineSpacing, oy, oy + S2);"))
{
throw new InvalidOperationException(sourcePath + ": square shaft centerline must reuse the break-aware centerline drawing.");
}
}
}