diff --git a/Content.IntegrationTests/Tests/CargoTest.cs b/Content.IntegrationTests/Tests/CargoTest.cs index 37fd3a80f9..489054c4bd 100644 --- a/Content.IntegrationTests/Tests/CargoTest.cs +++ b/Content.IntegrationTests/Tests/CargoTest.cs @@ -7,6 +7,7 @@ using Content.Server.Nutrition.Components; using Content.Server.Nutrition.EntitySystems; using Content.Shared.Cargo.Prototypes; using Content.Shared.IdentityManagement; +using Content.Shared.Prototypes; using Content.Shared.Stacks; using Content.Shared.Tag; using Content.Shared.Whitelist; @@ -104,51 +105,34 @@ public sealed class CargoTest await using var pair = await PoolManager.GetServerClient(); var server = pair.Server; - var testMap = await pair.CreateTestMap(); - - var entManager = server.ResolveDependency(); - var mapManager = server.ResolveDependency(); - var protoManager = server.ResolveDependency(); + var protoManager = server.ProtoMan; + var compFact = server.ResolveDependency(); await server.WaitAssertion(() => { - var mapId = testMap.MapId; - var grid = mapManager.CreateGridEntity(mapId); - var coord = new EntityCoordinates(grid.Owner, 0, 0); - var protoIds = protoManager.EnumeratePrototypes() .Where(p => !p.Abstract) .Where(p => !pair.IsTestPrototype(p)) - .Where(p => !p.Components.ContainsKey("MapGrid")) // Grids are not for sale. - .Select(p => p.ID) + .Where(p => p.Components.ContainsKey("StaticPrice")) .ToList(); foreach (var proto in protoIds) { - var ent = entManager.SpawnEntity(proto, coord); + // Sanity check + Assert.That(proto.TryGetComponent(out var staticPriceComp, compFact), Is.True); - if (entManager.TryGetComponent(ent, out var stackpricecomp) - && stackpricecomp.Price > 0) + if (proto.TryGetComponent(out var stackPriceComp, compFact) && stackPriceComp.Price > 0) { - if (entManager.TryGetComponent(ent, out var staticpricecomp)) - { - Assert.That(staticpricecomp.Price, Is.EqualTo(0), - $"The prototype {proto} has a StackPriceComponent and StaticPriceComponent whose values are not compatible with each other."); - } + Assert.That(staticPriceComp.Price, Is.EqualTo(0), + $"The prototype {proto} has a StackPriceComponent and StaticPriceComponent whose values are not compatible with each other."); } - if (entManager.HasComponent(ent)) + if (proto.HasComponent(compFact)) { - if (entManager.TryGetComponent(ent, out var staticpricecomp)) - { - Assert.That(staticpricecomp.Price, Is.EqualTo(0), - $"The prototype {proto} has a StackComponent and StaticPriceComponent whose values are not compatible with each other."); - } + Assert.That(staticPriceComp.Price, Is.EqualTo(0), + $"The prototype {proto} has a StackComponent and StaticPriceComponent whose values are not compatible with each other."); } - - entManager.DeleteEntity(ent); } - mapManager.DeleteMap(mapId); }); await pair.CleanReturnAsync();