diff --git a/test/unit/CounterDrone.Core.Tests/FullPipelineTests.cs b/test/unit/CounterDrone.Core.Tests/FullPipelineTests.cs index 8f2608f..1a7e0e0 100644 --- a/test/unit/CounterDrone.Core.Tests/FullPipelineTests.cs +++ b/test/unit/CounterDrone.Core.Tests/FullPipelineTests.cs @@ -538,5 +538,67 @@ namespace CounterDrone.Core.Tests Assert.True(launched > 0, msg); Assert.True(eng.Drones.All(d => d.Status == DroneStatus.Destroyed), msg); } + + // ═══════════════════════════════════════════════ + // 场景 7:3 架活塞编队 + 空基平台(横排 Z=0/50/100)— 空基多无人机端到端 + // 验证空基平台对多车道编队的拦截能力 + // ═══════════════════════════════════════════════ + + [Fact] + public void Scenario_3DronesAirBased_AllDestroyed() + { + var task = _scenario.CreateTask("3架空基编队拦截测试", ""); + _taskId = task.Id; + + _scenario.SaveScene(_taskId, new CombatScene { WindSpeed = 0 }); + _scenario.SaveTarget(_taskId, new TargetConfig + { + GroupId = "default", TargetType = (int)TargetType.Piston, + PowerType = (int)PowerType.Piston, + Quantity = 3, + TypicalSpeed = 150, TypicalAltitude = 500, + }); + // 3 架横排编队:Formation 模式,横向间距 50m,Z=0/50/100 + _scenario.SaveRoute(_taskId, "default", new RoutePlan + { + FormationMode = (int)FormationMode.Formation, + LateralSpacing = 50, + LateralCount = 3, + LongitudinalCount = 1, + }, + new List + { + new Waypoint { PosX = 0, PosY = 500, PosZ = 0, Speed = 150 }, + new Waypoint { PosX = 10000, PosY = 500, PosZ = 0, Speed = 150 }, + }); + // 3 个空基平台单元,部署在航路前方 + _scenario.SaveDeployment(_taskId, new List + { + MakeEquipment(DefaultFireUnits.GetById("air-standard"), AerosolType.InertGas, 3, 1500, 1000, 0), + }); + _scenario.SaveCloudDispersal(_taskId, new CloudDispersal { AerosolType = (int)AerosolType.InertGas, DisperseHeight = 500 }); + + // 验证:空基 PlatformType 正确持久化 + var savedAir = _scenario.GetTaskDetail(_taskId)!; + Assert.All(savedAir.Equipment, eq => Assert.Equal((int?)0, eq.PlatformType)); + + var eng = RunSimulation(8000); + + // 诊断:空基发射事件应有"空基"描述 + Assert.All(eng.Events.Where(e => e.Type == SimEventType.MunitionLaunched), + e => Assert.Contains("空基", e.Description)); + + var launched = eng.Events.Count(e => e.Type == SimEventType.MunitionLaunched); + var clouds = eng.Events.Count(e => e.Type == SimEventType.CloudGenerated); + + // 验证:3 架无人机都被击毁 + var msg = $"3DronesAir: launched={launched} clouds={clouds} drones={eng.Drones.Count}"; + foreach (var d in eng.Drones) + msg += $" [{d.Status} hp={d.Hp:F2} pos=({d.PosX:F0},{d.PosZ:F0})]"; + VerifyAndExportReport(eng, eng.Drones[0]); + Assert.Equal(3, eng.Drones.Count); + Assert.True(launched > 0, msg); + Assert.True(eng.Drones.All(d => d.Status == DroneStatus.Destroyed), msg); + } } }