diff --git a/Content.IntegrationTests/Tests/Atmos/AtmosHelpersTest.cs b/Content.IntegrationTests/Tests/Atmos/AtmosHelpersTest.cs index 06de0ea550..507c7c2a4a 100644 --- a/Content.IntegrationTests/Tests/Atmos/AtmosHelpersTest.cs +++ b/Content.IntegrationTests/Tests/Atmos/AtmosHelpersTest.cs @@ -91,6 +91,7 @@ namespace Content.IntegrationTests.Tests.Atmos await server.WaitIdleAsync(); } + // ReSharper disable once InconsistentNaming [Test] public async Task GetTileAtmosphereVector2iNotNullTest() { @@ -109,6 +110,7 @@ namespace Content.IntegrationTests.Tests.Atmos await server.WaitIdleAsync(); } + // ReSharper disable once InconsistentNaming [Test] public async Task GetTileAirVector2iNotNullTest() { @@ -127,6 +129,7 @@ namespace Content.IntegrationTests.Tests.Atmos await server.WaitIdleAsync(); } + // ReSharper disable once InconsistentNaming [Test] public async Task TryGetTileAtmosphereVector2iNotNullTest() { @@ -146,6 +149,7 @@ namespace Content.IntegrationTests.Tests.Atmos await server.WaitIdleAsync(); } + // ReSharper disable once InconsistentNaming [Test] public async Task TryGetTileAirVector2iNotNullTest() { diff --git a/Content.IntegrationTests/Tests/Body/LegTest.cs b/Content.IntegrationTests/Tests/Body/LegTest.cs index 1ccbe7aa99..cd24b653c7 100644 --- a/Content.IntegrationTests/Tests/Body/LegTest.cs +++ b/Content.IntegrationTests/Tests/Body/LegTest.cs @@ -17,7 +17,7 @@ namespace Content.IntegrationTests.Tests.Body [TestOf(typeof(BodyComponent))] public class LegTest : ContentIntegrationTest { - private const string PROTOTYPES = @" + private const string Prototypes = @" - type: entity name: HumanBodyAndAppearanceDummy id: HumanBodyAndAppearanceDummy @@ -32,7 +32,7 @@ namespace Content.IntegrationTests.Tests.Body [Test] public async Task RemoveLegsFallTest() { - var options = new ServerContentIntegrationOption{ExtraPrototypes = PROTOTYPES}; + var options = new ServerContentIntegrationOption{ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); AppearanceComponent appearance = null; diff --git a/Content.IntegrationTests/Tests/Body/LungTest.cs b/Content.IntegrationTests/Tests/Body/LungTest.cs index c0e827dbad..5c4d66caf7 100644 --- a/Content.IntegrationTests/Tests/Body/LungTest.cs +++ b/Content.IntegrationTests/Tests/Body/LungTest.cs @@ -8,7 +8,6 @@ using Content.Server.GameObjects.Components.Body.Circulatory; using Content.Server.GameObjects.Components.Metabolism; using Content.Shared.Atmos; using Content.Shared.GameObjects.Components.Body; -using Content.Shared.GameObjects.Components.Body.Mechanism; using NUnit.Framework; using Robust.Server.Interfaces.Maps; using Robust.Shared.Interfaces.GameObjects; @@ -23,7 +22,7 @@ namespace Content.IntegrationTests.Tests.Body [TestOf(typeof(LungBehavior))] public class LungTest : ContentIntegrationTest { - private const string PROTOTYPES = @" + private const string Prototypes = @" - type: entity name: HumanBodyAndBloodstreamDummy id: HumanBodyAndBloodstreamDummy @@ -52,7 +51,7 @@ namespace Content.IntegrationTests.Tests.Body [Test] public async Task AirConsistencyTest() { - var options = new ServerContentIntegrationOption{ExtraPrototypes = PROTOTYPES}; + var options = new ServerContentIntegrationOption{ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); server.Assert(() => @@ -139,7 +138,9 @@ namespace Content.IntegrationTests.Tests.Body [Test] public async Task NoSuffocationTest() { - var server = StartServerDummyTicker(); + var options = new ServerContentIntegrationOption{ExtraPrototypes = Prototypes}; + var server = StartServerDummyTicker(options); + await server.WaitIdleAsync(); var mapLoader = server.ResolveDependency(); @@ -165,7 +166,7 @@ namespace Content.IntegrationTests.Tests.Body { var center = new Vector2(0.5f, -1.5f); var coordinates = new EntityCoordinates(grid.GridEntityId, center); - human = entityManager.SpawnEntity("HumanMob_Content", coordinates); + human = entityManager.SpawnEntity("HumanBodyAndBloodstreamDummy", coordinates); Assert.True(human.TryGetComponent(out IBody body)); Assert.True(body.HasMechanismBehavior()); diff --git a/Content.IntegrationTests/Tests/Body/MechanismBehaviorEventsTest.cs b/Content.IntegrationTests/Tests/Body/MechanismBehaviorEventsTest.cs index 4ee94cc095..4e757305e3 100644 --- a/Content.IntegrationTests/Tests/Body/MechanismBehaviorEventsTest.cs +++ b/Content.IntegrationTests/Tests/Body/MechanismBehaviorEventsTest.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Threading.Tasks; using Content.Server.GameObjects.Components.Body.Behavior; using Content.Shared.GameObjects.Components.Body; -using Content.Shared.GameObjects.Components.Body.Behavior; using Content.Shared.GameObjects.Components.Body.Mechanism; using Content.Shared.GameObjects.Components.Body.Part; using NUnit.Framework; @@ -103,7 +102,7 @@ namespace Content.IntegrationTests.Tests.Body } } - private const string PROTOTYPES = @" + private const string Prototypes = @" - type: entity name: HumanBodyDummy id: HumanBodyDummy @@ -117,7 +116,7 @@ namespace Content.IntegrationTests.Tests.Body [Test] public async Task EventsTest() { - var options = new ServerContentIntegrationOption {ExtraPrototypes = PROTOTYPES}; + var options = new ServerContentIntegrationOption {ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); await server.WaitAssertion(() => diff --git a/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs b/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs index f3be87a348..fe4409a961 100644 --- a/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs +++ b/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs @@ -22,10 +22,14 @@ namespace Content.IntegrationTests.Tests.Buckle [TestOf(typeof(StrapComponent))] public class BuckleTest : ContentIntegrationTest { - private const string PROTOTYPES = @" + private const string BuckleDummyId = "BuckleDummy"; + private const string StrapDummyId = "StrapDummy"; + private const string ItemDummyId = "ItemDummy"; + + private static readonly string Prototypes = $@" - type: entity - name: BuckleDummy - id: BuckleDummy + name: {BuckleDummyId} + id: {BuckleDummyId} components: - type: Buckle - type: Hands @@ -35,15 +39,21 @@ namespace Content.IntegrationTests.Tests.Buckle centerSlot: torso - type: entity - name: StrapDummy - id: StrapDummy + name: {StrapDummyId} + id: {StrapDummyId} components: - type: Strap + +- type: entity + name: {ItemDummyId} + id: {ItemDummyId} + components: + - type: Item "; [Test] public async Task BuckleUnbuckleCooldownRangeTest() { - var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes}; var server = StartServer(options); IEntity human = null; @@ -60,8 +70,8 @@ namespace Content.IntegrationTests.Tests.Buckle var grid = mapManager.GetGrid(gridId); var coordinates = grid.GridEntityId.ToCoordinates(); - human = entityManager.SpawnEntity("BuckleDummy", coordinates); - chair = entityManager.SpawnEntity("StrapDummy", coordinates); + human = entityManager.SpawnEntity(BuckleDummyId, coordinates); + chair = entityManager.SpawnEntity(StrapDummyId, coordinates); // Default state, unbuckled Assert.True(human.TryGetComponent(out buckle)); @@ -194,7 +204,7 @@ namespace Content.IntegrationTests.Tests.Buckle [Test] public async Task BuckledDyingDropItemsTest() { - var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes}; var server = StartServer(options); IEntity human = null; @@ -213,8 +223,8 @@ namespace Content.IntegrationTests.Tests.Buckle var grid = mapManager.GetGrid(gridId); var coordinates = grid.GridEntityId.ToCoordinates(); - human = entityManager.SpawnEntity("BuckleDummy", coordinates); - IEntity chair = entityManager.SpawnEntity("StrapDummy", coordinates); + human = entityManager.SpawnEntity(BuckleDummyId, coordinates); + IEntity chair = entityManager.SpawnEntity(StrapDummyId, coordinates); // Component sanity check Assert.True(human.TryGetComponent(out buckle)); @@ -230,7 +240,7 @@ namespace Content.IntegrationTests.Tests.Buckle // Put an item into every hand for (var i = 0; i < hands.Count; i++) { - var akms = entityManager.SpawnEntity("RifleAk", coordinates); + var akms = entityManager.SpawnEntity(ItemDummyId, coordinates); // Equip items Assert.True(akms.TryGetComponent(out ItemComponent item)); @@ -280,7 +290,7 @@ namespace Content.IntegrationTests.Tests.Buckle [Test] public async Task ForceUnbuckleBuckleTest() { - var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes}; var server = StartServer(options); IEntity human = null; @@ -296,8 +306,8 @@ namespace Content.IntegrationTests.Tests.Buckle var grid = mapManager.GetGrid(gridId); var coordinates = grid.GridEntityId.ToCoordinates(); - human = entityManager.SpawnEntity("BuckleDummy", coordinates); - chair = entityManager.SpawnEntity("StrapDummy", coordinates); + human = entityManager.SpawnEntity(BuckleDummyId, coordinates); + chair = entityManager.SpawnEntity(StrapDummyId, coordinates); // Component sanity check Assert.True(human.TryGetComponent(out buckle)); diff --git a/Content.IntegrationTests/Tests/Damage/DamageTest.cs b/Content.IntegrationTests/Tests/Damageable/DamageableTest.cs similarity index 97% rename from Content.IntegrationTests/Tests/Damage/DamageTest.cs rename to Content.IntegrationTests/Tests/Damageable/DamageableTest.cs index caeea3865a..54d27c9760 100644 --- a/Content.IntegrationTests/Tests/Damage/DamageTest.cs +++ b/Content.IntegrationTests/Tests/Damageable/DamageableTest.cs @@ -11,9 +11,9 @@ namespace Content.IntegrationTests.Tests.Damageable { [TestFixture] [TestOf(typeof(DamageableComponent))] - public class DamageTest : ContentIntegrationTest + public class DamageableTest : ContentIntegrationTest { - private static readonly string DamageableEntityId = "DamageableEntityId"; + private const string DamageableEntityId = "DamageableEntityId"; private static readonly string Prototypes = $@" - type: entity @@ -36,7 +36,7 @@ namespace Content.IntegrationTests.Tests.Damageable var sEntityManager = server.ResolveDependency(); var sMapManager = server.ResolveDependency(); - IEntity sDamageableEntity = null; + IEntity sDamageableEntity; IDamageableComponent sDamageableComponent = null; await server.WaitPost(() => @@ -89,7 +89,7 @@ namespace Content.IntegrationTests.Tests.Damageable var sEntityManager = server.ResolveDependency(); var sMapManager = server.ResolveDependency(); - IEntity sDamageableEntity = null; + IEntity sDamageableEntity; IDamageableComponent sDamageableComponent = null; await server.WaitPost(() => diff --git a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs index cd87219e92..0efbb7b69e 100644 --- a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs +++ b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs @@ -50,7 +50,7 @@ namespace Content.IntegrationTests.Tests.Disposal UnitContains(unit, result, entities); } - private void Flush(DisposalUnitComponent unit, bool result, DisposalEntryComponent? entry = null, params IEntity[] entities) + private void Flush(DisposalUnitComponent unit, bool result, params IEntity[] entities) { Assert.That(unit.ContainedEntities, Is.SupersetOf(entities)); Assert.That(entities.Length, Is.EqualTo(unit.ContainedEntities.Count)); @@ -59,7 +59,7 @@ namespace Content.IntegrationTests.Tests.Disposal Assert.That(result || entities.Length == 0, Is.EqualTo(unit.ContainedEntities.Count == 0)); } - private const string PROTOTYPES = @" + private const string Prototypes = @" - type: entity name: HumanDummy id: HumanDummy @@ -95,13 +95,12 @@ namespace Content.IntegrationTests.Tests.Disposal [Test] public async Task Test() { - var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); IEntity human; IEntity wrench; DisposalUnitComponent unit; - DisposalEntryComponent entry; server.Assert(async () => { @@ -119,7 +118,7 @@ namespace Content.IntegrationTests.Tests.Disposal // Test for components existing Assert.True(disposalUnit.TryGetComponent(out unit!)); - Assert.True(disposalTrunk.TryGetComponent(out entry!)); + Assert.True(disposalTrunk.HasComponent()); // Can't insert, unanchored and unpowered var disposalUnitAnchorable = disposalUnit.GetComponent(); @@ -146,13 +145,13 @@ namespace Content.IntegrationTests.Tests.Disposal disposalTrunk.Transform.WorldPosition += (1, 0); // Fail to flush with a mob and an item - Flush(unit, false, null, human, wrench); + Flush(unit, false, human, wrench); // Move the disposal trunk back disposalTrunk.Transform.WorldPosition -= (1, 0); // Fail to flush with a mob and an item, no power - Flush(unit, false, entry, human, wrench); + Flush(unit, false, human, wrench); // Remove power need Assert.True(disposalUnit.TryGetComponent(out PowerReceiverComponent? power)); @@ -160,10 +159,10 @@ namespace Content.IntegrationTests.Tests.Disposal Assert.True(unit.Powered); // Flush with a mob and an item - Flush(unit, true, entry, human, wrench); + Flush(unit, true, human, wrench); // Re-pressurizing - Flush(unit, false, entry); + Flush(unit, false); }); await server.WaitIdleAsync(); diff --git a/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs b/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs index f2198fdc21..b8eb7ff7f6 100644 --- a/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs +++ b/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs @@ -16,7 +16,7 @@ namespace Content.IntegrationTests.Tests.DoAfter [TestOf(typeof(DoAfterComponent))] public class DoAfterServerTest : ContentIntegrationTest { - private const string PROTOTYPES = @" + private const string Prototypes = @" - type: entity name: Dummy id: Dummy @@ -28,7 +28,7 @@ namespace Content.IntegrationTests.Tests.DoAfter public async Task TestFinished() { Task task = null; - var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); // That it finishes successfully @@ -52,7 +52,7 @@ namespace Content.IntegrationTests.Tests.DoAfter public async Task TestCancelled() { Task task = null; - var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); server.Post(() => diff --git a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs index ce2cd67532..818dd3e4e1 100644 --- a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs +++ b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs @@ -14,17 +14,35 @@ namespace Content.IntegrationTests.Tests.Doors [TestOf(typeof(AirlockComponent))] public class AirlockTest : ContentIntegrationTest { - private const string PROTOTYPES = @" + private const string Prototypes = @" +- type: entity + name: PhysicsDummy + id: PhysicsDummy + components: + - type: Physics + anchored: false + shapes: + - !type:PhysShapeAabb + bounds: ""-0.49,-0.49,0.49,0.49"" + layer: + - Impassable + - type: entity name: AirlockDummy id: AirlockDummy components: - type: Airlock + - type: Physics + shapes: + - !type:PhysShapeAabb + bounds: ""-0.49,-0.49,0.49,0.49"" + mask: + - Impassable "; [Test] public async Task OpenCloseDestroyTest() { - var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); await server.WaitIdleAsync(); @@ -39,7 +57,7 @@ namespace Content.IntegrationTests.Tests.Doors { mapManager.CreateNewMapEntity(MapId.Nullspace); - airlock = entityManager.SpawnEntity("Airlock", MapCoordinates.Nullspace); + airlock = entityManager.SpawnEntity("AirlockDummy", MapCoordinates.Nullspace); Assert.True(airlock.TryGetComponent(out airlockComponent)); Assert.That(airlockComponent.State, Is.EqualTo(DoorState.Closed)); @@ -85,7 +103,7 @@ namespace Content.IntegrationTests.Tests.Doors [Test] public async Task AirlockBlockTest() { - var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes}; var server = StartServer(options); await server.WaitIdleAsync(); @@ -93,24 +111,24 @@ namespace Content.IntegrationTests.Tests.Doors var mapManager = server.ResolveDependency(); var entityManager = server.ResolveDependency(); - IEntity human = null; + IEntity physicsDummy = null; IEntity airlock = null; TestController controller = null; AirlockComponent airlockComponent = null; - var humanStartingX = -1; + var physicsDummyStartingX = -1; server.Assert(() => { var mapId = new MapId(1); mapManager.CreateNewMapEntity(mapId); - var humanCoordinates = new MapCoordinates((humanStartingX, 0), mapId); - human = entityManager.SpawnEntity("HumanMob_Content", humanCoordinates); + var humanCoordinates = new MapCoordinates((physicsDummyStartingX, 0), mapId); + physicsDummy = entityManager.SpawnEntity("PhysicsDummy", humanCoordinates); - airlock = entityManager.SpawnEntity("Airlock", new MapCoordinates((0, 0), mapId)); + airlock = entityManager.SpawnEntity("AirlockDummy", new MapCoordinates((0, 0), mapId)); - Assert.True(human.TryGetComponent(out IPhysicsComponent physics)); + Assert.True(physicsDummy.TryGetComponent(out IPhysicsComponent physics)); controller = physics.EnsureController(); @@ -136,10 +154,10 @@ namespace Content.IntegrationTests.Tests.Doors } // Sanity check - Assert.That(human.Transform.MapPosition.X, Is.GreaterThan(humanStartingX)); + Assert.That(physicsDummy.Transform.MapPosition.X, Is.GreaterThan(physicsDummyStartingX)); // Blocked by the airlock - Assert.That(human.Transform.MapPosition.X, Is.Negative.Or.Zero); + Assert.That(physicsDummy.Transform.MapPosition.X, Is.Negative.Or.Zero); } private class TestController : VirtualController { } diff --git a/Content.IntegrationTests/Tests/DummyIconTest.cs b/Content.IntegrationTests/Tests/DummyIconTest.cs index 4844a49237..de2dca1b9f 100644 --- a/Content.IntegrationTests/Tests/DummyIconTest.cs +++ b/Content.IntegrationTests/Tests/DummyIconTest.cs @@ -27,7 +27,7 @@ namespace Content.IntegrationTests.Tests { if (!proto.Components.ContainsKey("Sprite")) continue; - SpriteComponent.GetPrototypeTextures(proto, resourceCache).ToList(); + var _ = SpriteComponent.GetPrototypeTextures(proto, resourceCache).ToList(); } }); } diff --git a/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs b/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs index 00b6e8f00e..a574d4551f 100644 --- a/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs +++ b/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs @@ -118,11 +118,10 @@ namespace Content.IntegrationTests.Tests.Fluids var sEntityManager = server.ResolveDependency(); MapId sMapId = default; - IMapGrid sGrid = null; + IMapGrid sGrid; GridId sGridId = default; IEntity sGridEntity = null; EntityCoordinates sCoordinates = default; - TimerComponent sTimerComponent = null; // Spawn a paused map with one tile to spawn puddles on await server.WaitPost(() => @@ -170,7 +169,7 @@ namespace Content.IntegrationTests.Tests.Fluids Assert.Positive(sPuddle.EvaporateTime); // Should have a timer component added to it for evaporation - Assert.True(sPuddle.Owner.TryGetComponent(out sTimerComponent)); + Assert.True(sPuddle.Owner.TryGetComponent(out TimerComponent _)); sEvaporateTime = sPuddle.EvaporateTime; sPuddleStartingVolume = sPuddle.CurrentVolume; @@ -184,7 +183,7 @@ namespace Content.IntegrationTests.Tests.Fluids await server.WaitAssertion(() => { Assert.True(sPuddle.Owner.Paused); - Assert.True(sPuddle.Owner.TryGetComponent(out sTimerComponent)); + Assert.True(sPuddle.Owner.TryGetComponent(out TimerComponent _)); // Check that the puddle still exists Assert.False(sPuddle.Owner.Deleted); diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs index 5910ba4a26..87dca39b31 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Threading.Tasks; using Content.Client.GameObjects.Components.Items; using Content.Server.GameObjects.Components.ActionBlocking; -using Content.Server.GameObjects.Components.Body; using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Shared.GameObjects.Components.Body; using NUnit.Framework; @@ -20,7 +19,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking [TestOf(typeof(HandcuffComponent))] public class HandCuffTest : ContentIntegrationTest { - private const string PROTOTYPES = @" + private const string Prototypes = @" - type: entity name: HumanDummy id: HumanDummy @@ -41,18 +40,15 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking [Test] public async Task Test() { - var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); IEntity human; IEntity otherHuman; IEntity cuffs; IEntity secondCuffs; - HandcuffComponent handcuff; - HandcuffComponent secondHandcuff; CuffableComponent cuffed; IHandsComponent hands; - IBody body; server.Assert(() => { @@ -72,9 +68,9 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking // Test for components existing Assert.True(human.TryGetComponent(out cuffed!), $"Human has no {nameof(CuffableComponent)}"); Assert.True(human.TryGetComponent(out hands!), $"Human has no {nameof(HandsComponent)}"); - Assert.True(human.TryGetComponent(out body!), $"Human has no {nameof(IBody)}"); - Assert.True(cuffs.TryGetComponent(out handcuff!), $"Handcuff has no {nameof(HandcuffComponent)}"); - Assert.True(secondCuffs.TryGetComponent(out secondHandcuff!), $"Second handcuffs has no {nameof(HandcuffComponent)}"); + Assert.True(human.TryGetComponent(out IBody _), $"Human has no {nameof(IBody)}"); + Assert.True(cuffs.TryGetComponent(out HandcuffComponent _), $"Handcuff has no {nameof(HandcuffComponent)}"); + Assert.True(secondCuffs.TryGetComponent(out HandcuffComponent _), $"Second handcuffs has no {nameof(HandcuffComponent)}"); // Test to ensure cuffed players register the handcuffs cuffed.TryAddNewCuffs(human, cuffs); diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs index 61dde3b4e8..675f55f23c 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs @@ -8,14 +8,14 @@ using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.Components.Mobs; using Content.Shared.Actions; using Content.Shared.GameObjects.Components.Mobs; +using Content.Shared.Utility; using NUnit.Framework; using Robust.Client.Interfaces.UserInterface; using Robust.Client.Player; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.Map; -using Content.Shared.Utility; using Robust.Shared.Interfaces.Timing; +using Robust.Shared.Map; using Robust.Shared.Utility; namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs @@ -27,7 +27,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs [TestOf(typeof(ItemActionsComponent))] public class ActionsComponentTests : ContentIntegrationTest { - const string PROTOTYPES = @" + const string Prototypes = @" - type: entity name: flashlight parent: BaseItem @@ -72,7 +72,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { var player = serverPlayerManager.GetAllPlayers().Single(); var playerEnt = player.AttachedEntity; - var actionsComponent = playerEnt.GetComponent(); + var actionsComponent = playerEnt!.GetComponent(); // player should begin with their innate actions granted innateActions.AddRange(actionsComponent.InnateActions); @@ -94,12 +94,12 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs var clientPlayerMgr = client.ResolveDependency(); var clientUIMgr = client.ResolveDependency(); var expectedOrder = new List(); + await client.WaitAssertion(() => { - var local = clientPlayerMgr.LocalPlayer; - var controlled = local.ControlledEntity; - var actionsComponent = controlled.GetComponent(); + var controlled = local!.ControlledEntity; + var actionsComponent = controlled!.GetComponent(); // we should have our innate actions and debug1. foreach (var innateAction in innateActions) @@ -155,7 +155,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { var player = serverPlayerManager.GetAllPlayers().Single(); var playerEnt = player.AttachedEntity; - var actionsComponent = playerEnt.GetComponent(); + var actionsComponent = playerEnt!.GetComponent(); actionsComponent.Revoke(ActionType.DebugInstant); }); @@ -164,10 +164,9 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs await client.WaitAssertion(() => { - var local = clientPlayerMgr.LocalPlayer; - var controlled = local.ControlledEntity; - var actionsComponent = controlled.GetComponent(); + var controlled = local!.ControlledEntity; + var actionsComponent = controlled!.GetComponent(); // we should have our innate actions, but debug1 should be revoked foreach (var innateAction in innateActions) @@ -175,7 +174,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs Assert.That(actionsComponent.TryGetActionState(innateAction, out var innateState)); Assert.That(innateState.Enabled); } - Assert.That(actionsComponent.TryGetActionState(ActionType.DebugInstant, out var state), Is.False); + Assert.That(actionsComponent.TryGetActionState(ActionType.DebugInstant, out _), Is.False); // all actions should be in the same order as before, but the slot with DebugInstant should appear // disabled. @@ -195,6 +194,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs Assert.That(slot.Action, Is.Not.Null); var asAction = slot.Action as ActionPrototype; Assert.That(asAction, Is.Not.Null); + Assert.That(expected, Is.EqualTo(asAction.ActionType)); if (asAction.ActionType == ActionType.DebugInstant) { @@ -211,7 +211,6 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs Assert.That(slot.Item, Is.Null); Assert.That(slot.Action, Is.Null); Assert.That(slot.ActionEnabled, Is.False); - continue; } } }); @@ -220,8 +219,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs [Test] public async Task GrantsAndRevokesItemActions() { - var serverOptions = new ServerIntegrationOptions { ExtraPrototypes = PROTOTYPES }; - var clientOptions = new ClientIntegrationOptions { ExtraPrototypes = PROTOTYPES }; + var serverOptions = new ServerIntegrationOptions { ExtraPrototypes = Prototypes }; + var clientOptions = new ClientIntegrationOptions { ExtraPrototypes = Prototypes }; var (client, server) = await StartConnectedServerClientPair(serverOptions: serverOptions, clientOptions: clientOptions); await server.WaitIdleAsync(); @@ -241,7 +240,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs await server.WaitAssertion(() => { serverPlayerEnt = serverPlayerManager.GetAllPlayers().Single().AttachedEntity; - serverActionsComponent = serverPlayerEnt.GetComponent(); + serverActionsComponent = serverPlayerEnt!.GetComponent(); // spawn and give them an item that has actions serverFlashlight = serverEntManager.SpawnEntity("TestFlashlight", @@ -276,18 +275,17 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs // check that client has the actions, and toggle the light on via the action slot it was auto-assigned to var clientPlayerMgr = client.ResolveDependency(); var clientUIMgr = client.ResolveDependency(); - var clientEntMgr = client.ResolveDependency(); EntityUid clientFlashlight = default; await client.WaitAssertion(() => { var local = clientPlayerMgr.LocalPlayer; - var controlled = local.ControlledEntity; - clientActionsComponent = controlled.GetComponent(); + var controlled = local!.ControlledEntity; + clientActionsComponent = controlled!.GetComponent(); var lightEntry = clientActionsComponent.ItemActionStates() .Where(entry => entry.Value.ContainsKey(ItemActionType.ToggleLight)) .FirstOrNull(); - clientFlashlight = lightEntry.Value.Key; + clientFlashlight = lightEntry!.Value.Key; Assert.That(lightEntry, Is.Not.Null); Assert.That(lightEntry.Value.Value.TryGetValue(ItemActionType.ToggleLight, out var lightState)); Assert.That(lightState.Equals(new ActionState(true))); diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs index f9dccac864..66f1e85e68 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs @@ -17,7 +17,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement [TestOf(typeof(ClimbingComponent))] public class ClimbUnitTest : ContentIntegrationTest { - private const string PROTOTYPES = @" + private const string Prototypes = @" - type: entity name: HumanDummy id: HumanDummy @@ -35,12 +35,11 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement [Test] public async Task Test() { - var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); IEntity human; IEntity table; - ClimbableComponent climbable; ClimbingComponent climbing; server.Assert(() => @@ -56,20 +55,20 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement // Test for climb components existing // Players and tables should have these in their prototypes. - Assert.That(human.TryGetComponent(out climbing!), "Human has no climbing", Is.True); - Assert.That(table.TryGetComponent(out climbable!), "Table has no climbable", Is.True); + Assert.That(human.TryGetComponent(out climbing!), "Human has no climbing"); + Assert.That(table.TryGetComponent(out ClimbableComponent _), "Table has no climbable"); // Now let's make the player enter a climbing transitioning state. climbing.IsClimbing = true; climbing.TryMoveTo(human.Transform.WorldPosition, table.Transform.WorldPosition); var body = human.GetComponent(); - Assert.That(body.HasController(), "Player has no ClimbController", Is.True); + Assert.That(body.HasController(), "Player has no ClimbController"); // Force the player out of climb state. It should immediately remove the ClimbController. climbing.IsClimbing = false; - Assert.That(!body.HasController(), "Player wrongly has a ClimbController", Is.True); + Assert.That(!body.HasController(), "Player wrongly has a ClimbController"); }); diff --git a/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs b/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs index bdb654d364..261e538d35 100644 --- a/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs +++ b/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs @@ -6,7 +6,6 @@ using Content.Shared.GameObjects.Components.Mobs; using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Utility; using NUnit.Framework; -using Robust.Server.Interfaces.Timing; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Map; @@ -19,7 +18,7 @@ namespace Content.IntegrationTests.Tests.Gravity [TestOf(typeof(GravityGeneratorComponent))] public class WeightlessStatusTests : ContentIntegrationTest { - private const string PROTOTYPES = @" + private const string Prototypes = @" - type: entity name: HumanDummy id: HumanDummy @@ -29,15 +28,13 @@ namespace Content.IntegrationTests.Tests.Gravity [Test] public async Task WeightlessStatusTest() { - var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes}; var server = StartServer(options); await server.WaitIdleAsync(); var mapManager = server.ResolveDependency(); var entityManager = server.ResolveDependency(); - var pauseManager = server.ResolveDependency(); - var tileDefinitionManager = server.ResolveDependency(); IEntity human = null; SharedAlertsComponent alerts = null; diff --git a/Content.IntegrationTests/Tests/GravityGridTest.cs b/Content.IntegrationTests/Tests/GravityGridTest.cs index c373aeba2d..7daaea6994 100644 --- a/Content.IntegrationTests/Tests/GravityGridTest.cs +++ b/Content.IntegrationTests/Tests/GravityGridTest.cs @@ -17,7 +17,7 @@ namespace Content.IntegrationTests.Tests [TestOf(typeof(GravityGeneratorComponent))] public class GravityGridTest : ContentIntegrationTest { - private const string PROTOTYPES = @" + private const string Prototypes = @" - type: entity name: GravityGeneratorDummy id: GravityGeneratorDummy @@ -28,7 +28,7 @@ namespace Content.IntegrationTests.Tests [Test] public async Task Test() { - var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); IEntity generator = null; diff --git a/Content.IntegrationTests/Tests/GridTileLookupTest.cs b/Content.IntegrationTests/Tests/GridTileLookupTest.cs index ea304fdc94..c3aaa9e69b 100644 --- a/Content.IntegrationTests/Tests/GridTileLookupTest.cs +++ b/Content.IntegrationTests/Tests/GridTileLookupTest.cs @@ -13,7 +13,7 @@ namespace Content.IntegrationTests.Tests [TestFixture] public class GridTileLookupTest : ContentIntegrationTest { - private const string PROTOTYPES = @" + private const string Prototypes = @" - type: entity name: Dummy id: Dummy @@ -22,7 +22,7 @@ namespace Content.IntegrationTests.Tests [Test] public async Task Test() { - var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); await server.WaitIdleAsync(); diff --git a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs index dd2016e6e5..c899568638 100644 --- a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs +++ b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs @@ -16,7 +16,7 @@ namespace Content.IntegrationTests.Tests [TestOf(typeof(HumanInventoryControllerComponent))] public class HumanInventoryUniformSlotsTest : ContentIntegrationTest { - private const string PROTOTYPES = @" + private const string Prototypes = @" - type: entity name: HumanDummy id: HumanDummy @@ -59,7 +59,7 @@ namespace Content.IntegrationTests.Tests [Test] public async Task Test() { - var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); IEntity human = null; diff --git a/Content.IntegrationTests/Tests/InventoryHelpersTest.cs b/Content.IntegrationTests/Tests/InventoryHelpersTest.cs index c0478de53d..382215145d 100644 --- a/Content.IntegrationTests/Tests/InventoryHelpersTest.cs +++ b/Content.IntegrationTests/Tests/InventoryHelpersTest.cs @@ -16,7 +16,7 @@ namespace Content.IntegrationTests.Tests [TestOf(typeof(InventoryHelpers))] public class InventoryHelpersTest : ContentIntegrationTest { - private const string PROTOTYPES = @" + private const string Prototypes = @" - type: entity name: InventoryStunnableDummy id: InventoryStunnableDummy @@ -45,7 +45,7 @@ namespace Content.IntegrationTests.Tests [Test] public async Task SpawnItemInSlotTest() { - var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); IEntity human = null; @@ -83,7 +83,7 @@ namespace Content.IntegrationTests.Tests Assert.That(inventory.TryGetSlotItem(Slots.IDCARD, out ItemComponent _), Is.False); // Let's try skipping the interaction check and see if it equips it! - Assert.That(inventory.SpawnItemInSlot(Slots.IDCARD, "InventoryIDCardDummy", false)); + Assert.That(inventory.SpawnItemInSlot(Slots.IDCARD, "InventoryIDCardDummy")); Assert.That(inventory.TryGetSlotItem(Slots.IDCARD, out ItemComponent id)); Assert.That(id.Owner.Prototype != null && id.Owner.Prototype.ID == "InventoryIDCardDummy"); }); diff --git a/Content.IntegrationTests/Tests/PowerTest.cs b/Content.IntegrationTests/Tests/PowerTest.cs index 7fdc3c0c15..f7b8f0ce36 100644 --- a/Content.IntegrationTests/Tests/PowerTest.cs +++ b/Content.IntegrationTests/Tests/PowerTest.cs @@ -15,7 +15,7 @@ namespace Content.IntegrationTests.Tests [TestFixture] public class PowerTest : ContentIntegrationTest { - private const string PROTOTYPES = @" + private const string Prototypes = @" - type: entity name: GeneratorDummy id: GeneratorDummy @@ -118,7 +118,7 @@ namespace Content.IntegrationTests.Tests [Test] public async Task PowerNetTest() { - var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); PowerSupplierComponent supplier = null; @@ -169,7 +169,7 @@ namespace Content.IntegrationTests.Tests [Test] public async Task ApcChargingTest() { - var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); BatteryComponent apcBattery = null; @@ -217,7 +217,7 @@ namespace Content.IntegrationTests.Tests [Test] public async Task ApcNetTest() { - var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); PowerReceiverComponent receiver = null; diff --git a/Content.IntegrationTests/Tests/Pulling/PullTest.cs b/Content.IntegrationTests/Tests/Pulling/PullTest.cs index fbd430dce8..e03392bda9 100644 --- a/Content.IntegrationTests/Tests/Pulling/PullTest.cs +++ b/Content.IntegrationTests/Tests/Pulling/PullTest.cs @@ -16,7 +16,7 @@ namespace Content.IntegrationTests.Tests.Pulling [TestOf(typeof(PullController))] public class PullTest : ContentIntegrationTest { - private const string PROTOTYPES = @" + private const string Prototypes = @" - type: entity name: PullTestPullerDummy id: PullTestPullerDummy @@ -35,7 +35,7 @@ namespace Content.IntegrationTests.Tests.Pulling [Test] public async Task AnchoredNoPullTest() { - var options = new ServerContentIntegrationOption {ExtraPrototypes = PROTOTYPES}; + var options = new ServerContentIntegrationOption {ExtraPrototypes = Prototypes}; var server = StartServerDummyTicker(options); await server.WaitIdleAsync(); diff --git a/Content.IntegrationTests/Tests/SaveLoadSaveTest.cs b/Content.IntegrationTests/Tests/SaveLoadSaveTest.cs index 9c1e3e11ab..bacc793736 100644 --- a/Content.IntegrationTests/Tests/SaveLoadSaveTest.cs +++ b/Content.IntegrationTests/Tests/SaveLoadSaveTest.cs @@ -30,7 +30,7 @@ namespace Content.IntegrationTests.Tests mapLoader.SaveBlueprint(new GridId(1), "save load save 1.yml"); var mapId = mapManager.CreateMap(); var grid = mapLoader.LoadBlueprint(mapId, "save load save 1.yml"); - mapLoader.SaveBlueprint(grid.Index, "save load save 2.yml"); + mapLoader.SaveBlueprint(grid!.Index, "save load save 2.yml"); }); await server.WaitIdleAsync();