CadParamPluging/Tests/ShaftRightTopRadiusLeaderTests.cs

41 lines
1.4 KiB
C#

using System;
using System.IO;
public static class ShaftRightTopRadiusLeaderTests
{
public static int Main()
{
try
{
ShaftDrawersDoNotDrawRightTopRadiusLeader("Cad", "ShaftRawFreeForgeRoundShaftDrawer.cs");
ShaftDrawersDoNotDrawRightTopRadiusLeader("Cad", "ShaftRawFreeForgeSquareShaftDrawer.cs");
Console.WriteLine("Shaft right-top radius leader tests passed.");
return 0;
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
return 1;
}
}
private static void ShaftDrawersDoNotDrawRightTopRadiusLeader(params string[] pathParts)
{
var sourcePath = Path.Combine(pathParts);
var source = File.ReadAllText(sourcePath);
if (!source.Contains("private static void DrawHeadFilletRadiusLeader"))
{
throw new InvalidOperationException(sourcePath + ": radius leader helper should remain available for local history and narrow changes.");
}
var helperStart = source.IndexOf("private static void DrawHeadFilletRadiusLeader", StringComparison.Ordinal);
var mainFlow = source.Substring(0, helperStart);
if (mainFlow.Contains("DrawHeadFilletRadiusLeader(ctx,"))
{
throw new InvalidOperationException(sourcePath + ": shaft templates must not draw the right-top R radius leader.");
}
}
}