public static DamageOutput.WeaponEntry GetDamageEntry(Context context, Item item)
        {
            WeaponSystem weaponSystem;
            if (!TryGetWeaponSystem(item, out weaponSystem))
            {
                throw new ArgumentException("invalid item group for weapon analysis: " + item.GroupId);
            }

            List<DamageOutput.WeaponEntry.AmmoEntry> ammoEntries = new List<DamageOutput.WeaponEntry.AmmoEntry>();

            if (!IsNeedingAmmo(weaponSystem))
            {
                ammoEntries.Add(
                                new DamageOutput.WeaponEntry.AmmoEntry
                                {
                                    Ammunition = "(none)",
                                    Damage = GetDamage(item, item),
                                    OptimalInKm = item.GetAttributeById(OPTIMAL_ID)
                                                      .Value / 1000.0,
                                    FalloffInKm = item.GetAttributeById(FALLOFF_ID)
                                                      .Value / 1000.0,
                                    TrackingInRadPerSecond = item.GetAttributeById(TRACKING_ID)
                                        .Value
                                });
            }
            else
            {
                //TODO create service/DI
                using (var service = new FittingService())
                {
                    var ammo = new Ammo(service);

                    var factionAmmo = ammo.GetFactionAmmoForWeapon(item);
                    if (factionAmmo != null)
                    {
                        var factionEntry = GetAmmoEntry(context, item, factionAmmo);
                        ammoEntries.Add(factionEntry);
                    }

                    var t2Range = ammo.GetLongRangeT2AmmoForWeapon(item);
                    if (t2Range != null)
                    {
                        var t2RangeEntry = GetAmmoEntry(context, item, t2Range);
                        ammoEntries.Add(t2RangeEntry);
                    }

                    var t2Dps = ammo.GetHighDamageT2AmmoForWeapon(item);
                    if (t2Dps != null)
                    {
                        var t2DpsEntry = GetAmmoEntry(context, item, t2Dps);
                        ammoEntries.Add(t2DpsEntry);
                    }
                }
            }

            return new DamageOutput.WeaponEntry
                   {
                       AmmoEntries = ammoEntries.ToArray(),
                       WeaponSystem = weaponSystem,
                       WeaponType = item.TypeName
                   };
        }
        public void TestDamageOutput()
        {

            var start = DateTime.UtcNow;
        //    CrestSharp.Crest.Settings.Cache = new CrestCacheWithSessionCache(new CrestSqliteCache());
        CrestSharp.Crest.Settings.Cache = new CrestSqliteCache();
            var allVCharacter = _service.GetAllVCharacter();
            var copy = allVCharacter.Copy();


            var ship = _service.CreateShip("Ishtar");
            //TODO distinct und bei mehreren dann copy verwenden
            var items = _service.CreateItems("Drone Damage Amplifier II", "Drone Damage Amplifier II", "Dual 180mm AutoCannon II", "Dual 180mm AutoCannon II", "Dual 180mm AutoCannon II");
            var gun = _service.CreateItem("Dual 180mm AutoCannon II");
            ship.InstalledItems.AddRange(items);

            //TODO new DamageAnalysis(_service);
            DamageAnalysis.AddDrones(ship);

            Assert.AreEqual(5, ship.InstalledItems.Count(x => x.TypeName == "Ogre II"));

            var ammo = new Ammo(_service).GetFactionAmmoForWeapon(gun);
            foreach (var curItem in items.Where(x => x.TypeName == gun.TypeName))
            {
                curItem.InstalledItems.Add(ammo);
            }

            var context = new Context
            {
                Ship = ship,
                Target = _service.CreateItem("Rifter"),
                Char = allVCharacter,
                Area = new Item()
            };
            context.Char.InstalledItems.Add(ship);
            context.Char.Activate(context);
            Console.WriteLine($"time: {(DateTime.UtcNow - start).TotalSeconds}s");
            var damage = DamageAnalysis.GetDamageOutput(context);
            Assert.AreEqual(2, damage.Entries.Count());


        }