using Kompas.Mcp.Core.Documents; using Kompas.Mcp.Core.Editing; using Kompas.Mcp.Core.Modeling; using Kompas.Mcp.Core.Query; namespace Kompas.Mcp.Tests.Integration; /// Интеграция: прямое редактирование — перемещение грани (FaceMover). [Trait("Category", "Integration")] [Collection(KompasCollection.Name)] public sealed class FaceEditTests : IntegrationTestBase { private readonly DocumentService _docs; private readonly PartModeler _modeler; private readonly FaceEditService _faceEdit; private readonly QueryService _query; public FaceEditTests(KompasFixture fx) : base(fx) { _docs = new DocumentService(fx.Session, fx.Dispatcher); _modeler = new PartModeler(fx.Session, fx.Dispatcher); _faceEdit = new FaceEditService(fx.Session, fx.Dispatcher); _query = new QueryService(fx.Session, fx.Dispatcher); } [Fact] public async Task Move_face_grows_part_height_by_offset() { await _docs.CreateAsync(KompasDocumentType.Part); try { // Брусок 30×20×10 на XOY: X[0;30], Y[0;20], Z[0;10]. Верхняя грань — Z=10, центр (15,10,10). var s = await _modeler.OpenSketchAsync(BasePlane.XOY); await _modeler.AddRectangleAsync(s, 0, 0, 30, 20); await _modeler.CloseSketchAsync(s); await _modeler.ExtrudeAsync(s, depth: 10); await _modeler.RebuildAsync(); // Толкаем верхнюю грань на +2 мм наружу → высота 10 → 12. await _faceEdit.MoveFaceAsync(15, 10, 10, distance: 2); await _modeler.RebuildAsync(); var bb = await _query.GetBoundingBoxAsync(); Assert.InRange(bb.SizeZ, 11.9, 12.1); } finally { await _docs.CloseAsync(save: false); } } }