NavisworksTransport/run-unit-tests.bat
tian 818a5e0ad7 refactor: ModelItemTreeWalker 通用遍历工具(统一 IsHidden 剪枝 + 聚合盒剪枝 + 后序传播)
新增 src/Utils/ModelItemTreeWalker.cs:
- WalkVisible/WalkModels:深度遍历,IsHidden 剪枝内置(父隐藏 → 整棵子树跳过)
- 回调返回 ModelItemWalkAction(Prune/Continue/Hit)——剪枝条件与深入策略由调用方决定
- Hit 触发父级后序传播(postHitVisit)——共享祖先只上传一次(消除 K×D 枚举)
- onHidden 回调(隐藏节点统计)

迁移:
- SectionBoxExporter.TraverseAndCollect → walker(聚合盒剪枝 + 后序传播语义不变)
- ModelItemAnalysisHelper.GetAllVisibleGeometryItems → walker(栈式循环替换,统计保留)

修复:
- run-unit-tests.bat 过滤器排除 NavisworksIntegrationF1(F1 测试此前会被单元测试集选中,
  无主 NW 环境时失败)

验证:单元 244/244、集成 25/25(SectionBox 61ms)、Architecture 111ms(无回退)、对象 228 一致
2026-08-06 10:53:18 +08:00

58 lines
2.1 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
setlocal
echo Building NavisworksTransport.UnitTests...
set MSBUILD_PATH="C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe"
if not exist %MSBUILD_PATH% (
set MSBUILD_PATH="C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe"
)
if not exist %MSBUILD_PATH% (
echo MSBuild not found. Please install Visual Studio 2022 or Build Tools.
exit /b 1
)
set VSTEST_PATH="C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\TestPlatform\vstest.console.exe"
if not exist %VSTEST_PATH% (
set VSTEST_PATH="C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\TestPlatform\vstest.console.exe"
)
if not exist %VSTEST_PATH% (
echo vstest.console.exe not found. Please install Visual Studio 2022 test tools.
exit /b 1
)
REM 动态查找 MSTest adapter避免包版本升级后硬编码路径失效
for /d %%d in ("packages\MSTest.TestAdapter.*") do set TEST_ADAPTER_BASE=%%~fd
if not defined TEST_ADAPTER_BASE (
echo MSTest adapter package not found under packages\MSTest.TestAdapter.*
exit /b 1
)
set "TEST_ADAPTER_PATH=%TEST_ADAPTER_BASE%\build\net462"
if not exist "%TEST_ADAPTER_PATH%" (
echo MSTest adapter net462 dir not found: %TEST_ADAPTER_PATH%
exit /b 1
)
echo Using MSTest adapter: %TEST_ADAPTER_PATH%
set NAVISWORKS_PATH=C:\Program Files\Autodesk\Navisworks Manage 2026
if not exist "%NAVISWORKS_PATH%\Autodesk.Navisworks.Api.dll" (
echo Navisworks API path not found: %NAVISWORKS_PATH%
exit /b 1
)
set PATH=%NAVISWORKS_PATH%;%PATH%
%MSBUILD_PATH% "NavisworksTransport.UnitTests.csproj" /p:Configuration=Release /p:Platform=x64 /verbosity:minimal
if errorlevel 1 (
echo Unit test build failed!
exit /b 1
)
%VSTEST_PATH% "bin\x64\Release\NavisworksTransport.UnitTests.dll" /Platform:x64 /TestAdapterPath:%TEST_ADAPTER_PATH% /TestCaseFilter:"TestCategory!=NavisworksIntegration&TestCategory!=NavisworksIntegrationF1"
if errorlevel 1 (
echo Unit tests failed!
exit /b 1
)
echo Unit tests passed!