using Kompas.Mcp.Core.Documents; using Kompas.Mcp.Core.Modeling; using Kompas.Mcp.Core.Validation; namespace Kompas.Mcp.Tests.Integration; /// Интеграция: валидация построения (ошибки/перестроение операций). [Trait("Category", "Integration")] [Collection(KompasCollection.Name)] public sealed class ValidationTests : IntegrationTestBase { private readonly DocumentService _docs; private readonly PartModeler _modeler; private readonly ValidationService _validation; public ValidationTests(KompasFixture fx) : base(fx) { _docs = new DocumentService(fx.Session, fx.Dispatcher); _modeler = new PartModeler(fx.Session, fx.Dispatcher); _validation = new ValidationService(fx.Session, fx.Dispatcher); } [Fact] public async Task Valid_part_reports_no_errors() { await _docs.CreateAsync(KompasDocumentType.Part); try { var s = await _modeler.OpenSketchAsync(BasePlane.XOY); await _modeler.AddRectangleAsync(s, 0, 0, 20, 20); await _modeler.CloseSketchAsync(s); await _modeler.ExtrudeAsync(s, depth: 10); await _modeler.RebuildAsync(); var errors = await _validation.ValidatePartAsync(); Assert.Empty(errors); } finally { await _docs.CloseAsync(save: false); } } }