41 lines
1.6 KiB
C#
41 lines
1.6 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace NavisworksTransport.UnitTests.Integration
|
|
{
|
|
[TestClass]
|
|
[TestCategory("NavisworksIntegration")]
|
|
[TestCategory("NavisworksIntegration.Ground")]
|
|
public class AutoPathGridGenerationAutomationTests
|
|
{
|
|
[TestMethod]
|
|
[Timeout(240000)]
|
|
public async Task GroundAutoPathGrid_DefaultRoute_ObstacleCellsShouldCoverAtLeastHalfOfGrid()
|
|
{
|
|
using (var client = new NavisworksTestAutomationClient())
|
|
{
|
|
await client.EnsureServiceReadyAsync(TimeSpan.FromSeconds(90)).ConfigureAwait(false);
|
|
|
|
JObject response = await client.AnalyzeAutoPathGridAsync("Ground").ConfigureAwait(false);
|
|
Assert.IsTrue(response.Value<bool>("ok"), "测试 HTTP 接口返回失败: " + (string)response["error"]);
|
|
|
|
JObject data = (JObject)response["data"];
|
|
Assert.IsNotNull(data, "缺少测试结果 data");
|
|
|
|
JObject gridStats = (JObject)data["gridStats"];
|
|
Assert.IsNotNull(gridStats, "缺少 gridStats");
|
|
|
|
int totalCellCount = (int)gridStats["totalCellCount"];
|
|
int obstacleCellCount = (int)gridStats["obstacleCellCount"];
|
|
|
|
Assert.IsTrue(totalCellCount > 0, "网格总数必须大于 0");
|
|
Assert.IsTrue(
|
|
obstacleCellCount * 2 >= totalCellCount,
|
|
$"当前障碍物网格数量过少: obstacle={obstacleCellCount}, total={totalCellCount}");
|
|
}
|
|
}
|
|
}
|
|
}
|