CounterDroneBackend/test/unit/CounterDrone.Core.Tests/TestData.cs
tian 235c111a75 refactor: 集成测试使用预设想定 + 航线预设
defaults.json 新增 routes 航线预设 (3km/5km/10km/20km)

DefaultData 新增 RoutePreset/WaypointCoord,Routes 属性

DefaultScenarios 使用 R() 引用航线替代手写 MakeWaypoints

FullPipelineTests: LoadPreset/RunPreset 替代手写 setup,-500行

测试: 191 pass, 2 skip (DetectionDriven+3DronesAirBased), 24s
2026-06-15 16:18:51 +08:00

50 lines
4.3 KiB
C#
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.

using CounterDrone.Core;
using CounterDrone.Core.Models;
namespace CounterDrone.Core.Tests
{
/// <summary>测试用默认数据 — 内嵌 JSON不依赖文件系统</summary>
internal static class TestData
{
public static readonly DefaultData Defaults;
static TestData()
{
var json = @"
{
""version"": ""1"",
""ammunition"": [
{ ""Id"": ""inert"", ""AerosolType"": 0, ""Name"": ""惰性气体"", ""InitialRadius"": 3.8, ""CoreDensity"": 1.5, ""EdgeDensity"": 0.1, ""InitialTemperature"": 1800.0, ""BuoyancyFactor"": 0.3, ""EffectiveConcentration"": 0.0001, ""MaxRadius"": 100.0, ""MaxDuration"": 120.0, ""SourceStrength"": 10.0, ""BurstChargeKg"": 1.5, ""TurbulentExpansionK"": 3.0, ""ParticlesJson"": ""{}"" },
{ ""Id"": ""active"", ""AerosolType"": 1, ""Name"": ""活性材料"", ""InitialRadius"": 5.0, ""CoreDensity"": 2.0, ""EdgeDensity"": 0.2, ""InitialTemperature"": 2400.0, ""BuoyancyFactor"": 0.6, ""EffectiveConcentration"": 0.0001, ""MaxRadius"": 80.0, ""MaxDuration"": 90.0, ""SourceStrength"": 12.0, ""BurstChargeKg"": 4.0, ""TurbulentExpansionK"": 4.0, ""ParticlesJson"": ""{}"" },
{ ""Id"": ""fuel"", ""AerosolType"": 2, ""Name"": ""活性燃料"", ""InitialRadius"": 3.8, ""CoreDensity"": 1.8, ""EdgeDensity"": 0.15, ""InitialTemperature"": 1900.0, ""BuoyancyFactor"": 0.4, ""EffectiveConcentration"": 0.0001, ""MaxRadius"": 90.0, ""MaxDuration"": 100.0, ""SourceStrength"": 10.0, ""BurstChargeKg"": 1.5, ""TurbulentExpansionK"": 3.0, ""ParticlesJson"": ""{}"" }
],
""formations"": [
{ ""Id"": ""single"", ""Name"": ""单机"", ""FormationMode"": 0, ""LateralCount"": 1, ""LongitudinalCount"": 1, ""LateralSpacing"": 0, ""LongitudinalSpacing"": 0 },
{ ""Id"": ""line-3"", ""Name"": ""3机横队"", ""FormationMode"": 1, ""LateralCount"": 3, ""LongitudinalCount"": 1, ""LateralSpacing"": 50, ""LongitudinalSpacing"": 0 }
],
""routes"": [
{ ""Id"": ""3km-h400"", ""Name"": ""3km-400m高"", ""Waypoints"": [{""X"":0,""Y"":400,""Z"":0},{""X"":3000,""Y"":400,""Z"":0}] },
{ ""Id"": ""3km-h300"", ""Name"": ""3km-300m高"", ""Waypoints"": [{""X"":0,""Y"":300,""Z"":0},{""X"":3000,""Y"":300,""Z"":0}] },
{ ""Id"": ""5km-h500"", ""Name"": ""5km-500m高"", ""Waypoints"": [{""X"":0,""Y"":500,""Z"":0},{""X"":5000,""Y"":500,""Z"":0}] },
{ ""Id"": ""5km-h800"", ""Name"": ""5km-800m高"", ""Waypoints"": [{""X"":0,""Y"":800,""Z"":0},{""X"":5000,""Y"":800,""Z"":0}] },
{ ""Id"": ""10km-h500"", ""Name"": ""10km-500m高"", ""Waypoints"": [{""X"":0,""Y"":500,""Z"":0},{""X"":10000,""Y"":500,""Z"":0}] }
],
""fireUnits"": [
{ ""Id"": ""ground-light"", ""Name"": ""轻型地基"", ""PlatformType"": 1, ""GunCount"": 4, ""ChannelsPerGun"": 4, ""ChannelInterval"": 0.1, ""Cooldown"": 5.0, ""AmmoChangeTime"": 30.0, ""MuzzleVelocity"": 800.0, ""AmmoTypes"": [0,1], ""RadarRange"": 10000.0, ""EORange"": 6000.0, ""IRRange"": 3000.0 },
{ ""Id"": ""ground-standard"", ""Name"": ""标准地基"", ""PlatformType"": 1, ""GunCount"": 4, ""ChannelsPerGun"": 4, ""ChannelInterval"": 0.1, ""Cooldown"": 5.0, ""AmmoChangeTime"": 30.0, ""MuzzleVelocity"": 800.0, ""AmmoTypes"": [0,1], ""RadarRange"": 15000.0, ""EORange"": 8000.0, ""IRRange"": 5000.0 },
{ ""Id"": ""ground-heavy"", ""Name"": ""重型地基"", ""PlatformType"": 1, ""GunCount"": 6, ""ChannelsPerGun"": 4, ""ChannelInterval"": 1.0, ""Cooldown"": 5.0, ""AmmoChangeTime"": 30.0, ""MuzzleVelocity"": 600.0, ""AmmoTypes"": [0,1,2], ""RadarRange"": 20000.0, ""EORange"": 10000.0, ""IRRange"": 6000.0 },
{ ""Id"": ""air-standard"", ""Name"": ""标准空基"", ""PlatformType"": 0, ""GunCount"": 1, ""ChannelsPerGun"": 8, ""ChannelInterval"": 1.0, ""Cooldown"": 5.0, ""AmmoChangeTime"": 30.0, ""CruiseSpeed"": 55.0, ""ReleaseAltitude"": 1500.0, ""AmmoTypes"": [0,1], ""EORange"": 12000.0, ""IRRange"": 8000.0 }
],
""targets"": [
{ ""Id"": ""shahed"", ""Name"": ""活塞巡飞弹"", ""TargetType"": 3, ""PowerType"": 1, ""Wingspan"": 2.5, ""TypicalSpeed"": 200.0, ""TypicalAltitude"": 500.0 }
],
""detectionEquipment"": [],
""weather"": [
{ ""Id"": ""sunny-calm"", ""Name"": ""晴天无风"", ""WeatherType"": 0, ""WindSpeed"": 3.0, ""WindDirection"": 0, ""Temperature"": 25.0, ""Humidity"": 50.0, ""Pressure"": 1013.0, ""Visibility"": 8000.0 }
]
}";
Defaults = DefaultData.FromJson(json);
}
}
}