- T11 路径编辑(PathEditingAutomationTests):删除点/更新位置/正交化/去环 - T12 路径导出(ExportImportRoundTripAutomationTests):XML/JSON 导出→导入回环 - T13 播放控制(AnimationPlaybackControlAutomationTests):pause 验证帧停止/resume 前进 - T14 批量队列(BatchQueueAutomationTests):队列添加/计数递增 - T15 路径分析(PathAnalysisAutomationTests):评分结构验证 - 服务端新增 5 端点:export-route-file/edit-route/animation-playback-control/batch-queue-add/analyze-path - 产品 bug 修复:PathDatabase.CollisionResults 表已废弃→GetCollisionCount 改查 CollisionReports、 SaveCollisions 异常保护;路径编辑真删点走 PathRoute.RemovePoint(RemovePathPoint 仅 3D 标记) 验证:集成测试 24/24 通过,完整集 74.6s(15fps/5s 动画)
58 lines
2.6 KiB
C#
58 lines
2.6 KiB
C#
using System;
|
||
using System.Threading.Tasks;
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||
using Newtonsoft.Json.Linq;
|
||
|
||
namespace NavisworksTransport.UnitTests.Integration
|
||
{
|
||
/// <summary>
|
||
/// 批量任务队列集成测试(覆盖计划 T14,轻量版)。
|
||
///
|
||
/// 验证 BatchQueueManager 队列管理:
|
||
/// - 添加队列项返回有效 itemId
|
||
/// - 队列计数随添加递增
|
||
/// - 动画参数(帧率/时长)随队列项传递
|
||
///
|
||
/// 说明:不执行 ProcessQueueAsync(批量动画执行链路长且耗时),队列处理链路另行验证。
|
||
/// </summary>
|
||
[TestClass]
|
||
[TestCategory("NavisworksIntegration")]
|
||
public class BatchQueueAutomationTests
|
||
{
|
||
private const int TestFrameRate = 15;
|
||
private const double TestDurationSeconds = 5.0;
|
||
|
||
[TestMethod]
|
||
[Timeout(120000)]
|
||
public async Task BatchQueue_AddItems_QueueCountIncrements()
|
||
{
|
||
using (var client = new NavisworksTestAutomationClient())
|
||
{
|
||
await client.EnsureServiceReadyAsync(TimeSpan.FromSeconds(90)).ConfigureAwait(false);
|
||
|
||
// 1. 添加第一个队列项
|
||
JObject first = await client.BatchQueueAddAsync(
|
||
"自动测试_Ground", TestFrameRate, TestDurationSeconds).ConfigureAwait(false);
|
||
Assert.IsTrue(first.Value<bool>("ok"), "添加队列项失败: " + (string)first["error"]);
|
||
|
||
JObject firstData = (JObject)first["data"];
|
||
int firstItemId = (int)firstData["itemId"];
|
||
int queueAfterFirst = (int)firstData["queueCount"];
|
||
Assert.IsTrue(firstItemId > 0, "队列项 ID 无效");
|
||
Assert.IsTrue(queueAfterFirst >= 1, "添加后队列计数应 >= 1");
|
||
Assert.AreEqual("自动测试_Ground", (string)firstData["routeName"], "队列项路径名不匹配");
|
||
|
||
// 2. 添加第二个队列项,队列计数应递增
|
||
JObject second = await client.BatchQueueAddAsync(
|
||
"自动测试_Hoisting", TestFrameRate, TestDurationSeconds).ConfigureAwait(false);
|
||
Assert.IsTrue(second.Value<bool>("ok"), "添加第二个队列项失败: " + (string)second["error"]);
|
||
|
||
JObject secondData = (JObject)second["data"];
|
||
Assert.IsTrue((int)secondData["itemId"] > firstItemId, "第二个队列项 ID 应递增");
|
||
Assert.IsTrue((int)secondData["queueCount"] > queueAfterFirst, "队列计数应随添加递增");
|
||
Assert.IsFalse((bool)secondData["isExecuting"], "仅添加不应触发执行");
|
||
}
|
||
}
|
||
}
|
||
}
|