Cleanup integration tests prototype usage, naming and unused variables (#3114)

* Fix naming of prototypes variable in tests

* Remove unused variables in tests

* Remove unused variables in tests

* Replace content entities with test entities

* Fix airlock and lung test
This commit is contained in:
DrSmugleaf
2021-02-09 22:04:47 +01:00
committed by GitHub
parent 327257b8a4
commit 294b7c4d7f
22 changed files with 135 additions and 115 deletions

View File

@@ -91,6 +91,7 @@ namespace Content.IntegrationTests.Tests.Atmos
await server.WaitIdleAsync(); await server.WaitIdleAsync();
} }
// ReSharper disable once InconsistentNaming
[Test] [Test]
public async Task GetTileAtmosphereVector2iNotNullTest() public async Task GetTileAtmosphereVector2iNotNullTest()
{ {
@@ -109,6 +110,7 @@ namespace Content.IntegrationTests.Tests.Atmos
await server.WaitIdleAsync(); await server.WaitIdleAsync();
} }
// ReSharper disable once InconsistentNaming
[Test] [Test]
public async Task GetTileAirVector2iNotNullTest() public async Task GetTileAirVector2iNotNullTest()
{ {
@@ -127,6 +129,7 @@ namespace Content.IntegrationTests.Tests.Atmos
await server.WaitIdleAsync(); await server.WaitIdleAsync();
} }
// ReSharper disable once InconsistentNaming
[Test] [Test]
public async Task TryGetTileAtmosphereVector2iNotNullTest() public async Task TryGetTileAtmosphereVector2iNotNullTest()
{ {
@@ -146,6 +149,7 @@ namespace Content.IntegrationTests.Tests.Atmos
await server.WaitIdleAsync(); await server.WaitIdleAsync();
} }
// ReSharper disable once InconsistentNaming
[Test] [Test]
public async Task TryGetTileAirVector2iNotNullTest() public async Task TryGetTileAirVector2iNotNullTest()
{ {

View File

@@ -17,7 +17,7 @@ namespace Content.IntegrationTests.Tests.Body
[TestOf(typeof(BodyComponent))] [TestOf(typeof(BodyComponent))]
public class LegTest : ContentIntegrationTest public class LegTest : ContentIntegrationTest
{ {
private const string PROTOTYPES = @" private const string Prototypes = @"
- type: entity - type: entity
name: HumanBodyAndAppearanceDummy name: HumanBodyAndAppearanceDummy
id: HumanBodyAndAppearanceDummy id: HumanBodyAndAppearanceDummy
@@ -32,7 +32,7 @@ namespace Content.IntegrationTests.Tests.Body
[Test] [Test]
public async Task RemoveLegsFallTest() public async Task RemoveLegsFallTest()
{ {
var options = new ServerContentIntegrationOption{ExtraPrototypes = PROTOTYPES}; var options = new ServerContentIntegrationOption{ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
AppearanceComponent appearance = null; AppearanceComponent appearance = null;

View File

@@ -8,7 +8,6 @@ using Content.Server.GameObjects.Components.Body.Circulatory;
using Content.Server.GameObjects.Components.Metabolism; using Content.Server.GameObjects.Components.Metabolism;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Content.Shared.GameObjects.Components.Body; using Content.Shared.GameObjects.Components.Body;
using Content.Shared.GameObjects.Components.Body.Mechanism;
using NUnit.Framework; using NUnit.Framework;
using Robust.Server.Interfaces.Maps; using Robust.Server.Interfaces.Maps;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
@@ -23,7 +22,7 @@ namespace Content.IntegrationTests.Tests.Body
[TestOf(typeof(LungBehavior))] [TestOf(typeof(LungBehavior))]
public class LungTest : ContentIntegrationTest public class LungTest : ContentIntegrationTest
{ {
private const string PROTOTYPES = @" private const string Prototypes = @"
- type: entity - type: entity
name: HumanBodyAndBloodstreamDummy name: HumanBodyAndBloodstreamDummy
id: HumanBodyAndBloodstreamDummy id: HumanBodyAndBloodstreamDummy
@@ -52,7 +51,7 @@ namespace Content.IntegrationTests.Tests.Body
[Test] [Test]
public async Task AirConsistencyTest() public async Task AirConsistencyTest()
{ {
var options = new ServerContentIntegrationOption{ExtraPrototypes = PROTOTYPES}; var options = new ServerContentIntegrationOption{ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
server.Assert(() => server.Assert(() =>
@@ -139,7 +138,9 @@ namespace Content.IntegrationTests.Tests.Body
[Test] [Test]
public async Task NoSuffocationTest() public async Task NoSuffocationTest()
{ {
var server = StartServerDummyTicker(); var options = new ServerContentIntegrationOption{ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options);
await server.WaitIdleAsync(); await server.WaitIdleAsync();
var mapLoader = server.ResolveDependency<IMapLoader>(); var mapLoader = server.ResolveDependency<IMapLoader>();
@@ -165,7 +166,7 @@ namespace Content.IntegrationTests.Tests.Body
{ {
var center = new Vector2(0.5f, -1.5f); var center = new Vector2(0.5f, -1.5f);
var coordinates = new EntityCoordinates(grid.GridEntityId, center); 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(human.TryGetComponent(out IBody body));
Assert.True(body.HasMechanismBehavior<LungBehavior>()); Assert.True(body.HasMechanismBehavior<LungBehavior>());

View File

@@ -3,7 +3,6 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Content.Server.GameObjects.Components.Body.Behavior; using Content.Server.GameObjects.Components.Body.Behavior;
using Content.Shared.GameObjects.Components.Body; 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.Mechanism;
using Content.Shared.GameObjects.Components.Body.Part; using Content.Shared.GameObjects.Components.Body.Part;
using NUnit.Framework; using NUnit.Framework;
@@ -103,7 +102,7 @@ namespace Content.IntegrationTests.Tests.Body
} }
} }
private const string PROTOTYPES = @" private const string Prototypes = @"
- type: entity - type: entity
name: HumanBodyDummy name: HumanBodyDummy
id: HumanBodyDummy id: HumanBodyDummy
@@ -117,7 +116,7 @@ namespace Content.IntegrationTests.Tests.Body
[Test] [Test]
public async Task EventsTest() public async Task EventsTest()
{ {
var options = new ServerContentIntegrationOption {ExtraPrototypes = PROTOTYPES}; var options = new ServerContentIntegrationOption {ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
await server.WaitAssertion(() => await server.WaitAssertion(() =>

View File

@@ -22,10 +22,14 @@ namespace Content.IntegrationTests.Tests.Buckle
[TestOf(typeof(StrapComponent))] [TestOf(typeof(StrapComponent))]
public class BuckleTest : ContentIntegrationTest 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 - type: entity
name: BuckleDummy name: {BuckleDummyId}
id: BuckleDummy id: {BuckleDummyId}
components: components:
- type: Buckle - type: Buckle
- type: Hands - type: Hands
@@ -35,15 +39,21 @@ namespace Content.IntegrationTests.Tests.Buckle
centerSlot: torso centerSlot: torso
- type: entity - type: entity
name: StrapDummy name: {StrapDummyId}
id: StrapDummy id: {StrapDummyId}
components: components:
- type: Strap - type: Strap
- type: entity
name: {ItemDummyId}
id: {ItemDummyId}
components:
- type: Item
"; ";
[Test] [Test]
public async Task BuckleUnbuckleCooldownRangeTest() public async Task BuckleUnbuckleCooldownRangeTest()
{ {
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes};
var server = StartServer(options); var server = StartServer(options);
IEntity human = null; IEntity human = null;
@@ -60,8 +70,8 @@ namespace Content.IntegrationTests.Tests.Buckle
var grid = mapManager.GetGrid(gridId); var grid = mapManager.GetGrid(gridId);
var coordinates = grid.GridEntityId.ToCoordinates(); var coordinates = grid.GridEntityId.ToCoordinates();
human = entityManager.SpawnEntity("BuckleDummy", coordinates); human = entityManager.SpawnEntity(BuckleDummyId, coordinates);
chair = entityManager.SpawnEntity("StrapDummy", coordinates); chair = entityManager.SpawnEntity(StrapDummyId, coordinates);
// Default state, unbuckled // Default state, unbuckled
Assert.True(human.TryGetComponent(out buckle)); Assert.True(human.TryGetComponent(out buckle));
@@ -194,7 +204,7 @@ namespace Content.IntegrationTests.Tests.Buckle
[Test] [Test]
public async Task BuckledDyingDropItemsTest() public async Task BuckledDyingDropItemsTest()
{ {
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes};
var server = StartServer(options); var server = StartServer(options);
IEntity human = null; IEntity human = null;
@@ -213,8 +223,8 @@ namespace Content.IntegrationTests.Tests.Buckle
var grid = mapManager.GetGrid(gridId); var grid = mapManager.GetGrid(gridId);
var coordinates = grid.GridEntityId.ToCoordinates(); var coordinates = grid.GridEntityId.ToCoordinates();
human = entityManager.SpawnEntity("BuckleDummy", coordinates); human = entityManager.SpawnEntity(BuckleDummyId, coordinates);
IEntity chair = entityManager.SpawnEntity("StrapDummy", coordinates); IEntity chair = entityManager.SpawnEntity(StrapDummyId, coordinates);
// Component sanity check // Component sanity check
Assert.True(human.TryGetComponent(out buckle)); Assert.True(human.TryGetComponent(out buckle));
@@ -230,7 +240,7 @@ namespace Content.IntegrationTests.Tests.Buckle
// Put an item into every hand // Put an item into every hand
for (var i = 0; i < hands.Count; i++) for (var i = 0; i < hands.Count; i++)
{ {
var akms = entityManager.SpawnEntity("RifleAk", coordinates); var akms = entityManager.SpawnEntity(ItemDummyId, coordinates);
// Equip items // Equip items
Assert.True(akms.TryGetComponent(out ItemComponent item)); Assert.True(akms.TryGetComponent(out ItemComponent item));
@@ -280,7 +290,7 @@ namespace Content.IntegrationTests.Tests.Buckle
[Test] [Test]
public async Task ForceUnbuckleBuckleTest() public async Task ForceUnbuckleBuckleTest()
{ {
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes};
var server = StartServer(options); var server = StartServer(options);
IEntity human = null; IEntity human = null;
@@ -296,8 +306,8 @@ namespace Content.IntegrationTests.Tests.Buckle
var grid = mapManager.GetGrid(gridId); var grid = mapManager.GetGrid(gridId);
var coordinates = grid.GridEntityId.ToCoordinates(); var coordinates = grid.GridEntityId.ToCoordinates();
human = entityManager.SpawnEntity("BuckleDummy", coordinates); human = entityManager.SpawnEntity(BuckleDummyId, coordinates);
chair = entityManager.SpawnEntity("StrapDummy", coordinates); chair = entityManager.SpawnEntity(StrapDummyId, coordinates);
// Component sanity check // Component sanity check
Assert.True(human.TryGetComponent(out buckle)); Assert.True(human.TryGetComponent(out buckle));

View File

@@ -11,9 +11,9 @@ namespace Content.IntegrationTests.Tests.Damageable
{ {
[TestFixture] [TestFixture]
[TestOf(typeof(DamageableComponent))] [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 = $@" private static readonly string Prototypes = $@"
- type: entity - type: entity
@@ -36,7 +36,7 @@ namespace Content.IntegrationTests.Tests.Damageable
var sEntityManager = server.ResolveDependency<IEntityManager>(); var sEntityManager = server.ResolveDependency<IEntityManager>();
var sMapManager = server.ResolveDependency<IMapManager>(); var sMapManager = server.ResolveDependency<IMapManager>();
IEntity sDamageableEntity = null; IEntity sDamageableEntity;
IDamageableComponent sDamageableComponent = null; IDamageableComponent sDamageableComponent = null;
await server.WaitPost(() => await server.WaitPost(() =>
@@ -89,7 +89,7 @@ namespace Content.IntegrationTests.Tests.Damageable
var sEntityManager = server.ResolveDependency<IEntityManager>(); var sEntityManager = server.ResolveDependency<IEntityManager>();
var sMapManager = server.ResolveDependency<IMapManager>(); var sMapManager = server.ResolveDependency<IMapManager>();
IEntity sDamageableEntity = null; IEntity sDamageableEntity;
IDamageableComponent sDamageableComponent = null; IDamageableComponent sDamageableComponent = null;
await server.WaitPost(() => await server.WaitPost(() =>

View File

@@ -50,7 +50,7 @@ namespace Content.IntegrationTests.Tests.Disposal
UnitContains(unit, result, entities); 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(unit.ContainedEntities, Is.SupersetOf(entities));
Assert.That(entities.Length, Is.EqualTo(unit.ContainedEntities.Count)); 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)); Assert.That(result || entities.Length == 0, Is.EqualTo(unit.ContainedEntities.Count == 0));
} }
private const string PROTOTYPES = @" private const string Prototypes = @"
- type: entity - type: entity
name: HumanDummy name: HumanDummy
id: HumanDummy id: HumanDummy
@@ -95,13 +95,12 @@ namespace Content.IntegrationTests.Tests.Disposal
[Test] [Test]
public async Task Test() public async Task Test()
{ {
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
IEntity human; IEntity human;
IEntity wrench; IEntity wrench;
DisposalUnitComponent unit; DisposalUnitComponent unit;
DisposalEntryComponent entry;
server.Assert(async () => server.Assert(async () =>
{ {
@@ -119,7 +118,7 @@ namespace Content.IntegrationTests.Tests.Disposal
// Test for components existing // Test for components existing
Assert.True(disposalUnit.TryGetComponent(out unit!)); Assert.True(disposalUnit.TryGetComponent(out unit!));
Assert.True(disposalTrunk.TryGetComponent(out entry!)); Assert.True(disposalTrunk.HasComponent<DisposalEntryComponent>());
// Can't insert, unanchored and unpowered // Can't insert, unanchored and unpowered
var disposalUnitAnchorable = disposalUnit.GetComponent<AnchorableComponent>(); var disposalUnitAnchorable = disposalUnit.GetComponent<AnchorableComponent>();
@@ -146,13 +145,13 @@ namespace Content.IntegrationTests.Tests.Disposal
disposalTrunk.Transform.WorldPosition += (1, 0); disposalTrunk.Transform.WorldPosition += (1, 0);
// Fail to flush with a mob and an item // 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 // Move the disposal trunk back
disposalTrunk.Transform.WorldPosition -= (1, 0); disposalTrunk.Transform.WorldPosition -= (1, 0);
// Fail to flush with a mob and an item, no power // 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 // Remove power need
Assert.True(disposalUnit.TryGetComponent(out PowerReceiverComponent? power)); Assert.True(disposalUnit.TryGetComponent(out PowerReceiverComponent? power));
@@ -160,10 +159,10 @@ namespace Content.IntegrationTests.Tests.Disposal
Assert.True(unit.Powered); Assert.True(unit.Powered);
// Flush with a mob and an item // Flush with a mob and an item
Flush(unit, true, entry, human, wrench); Flush(unit, true, human, wrench);
// Re-pressurizing // Re-pressurizing
Flush(unit, false, entry); Flush(unit, false);
}); });
await server.WaitIdleAsync(); await server.WaitIdleAsync();

View File

@@ -16,7 +16,7 @@ namespace Content.IntegrationTests.Tests.DoAfter
[TestOf(typeof(DoAfterComponent))] [TestOf(typeof(DoAfterComponent))]
public class DoAfterServerTest : ContentIntegrationTest public class DoAfterServerTest : ContentIntegrationTest
{ {
private const string PROTOTYPES = @" private const string Prototypes = @"
- type: entity - type: entity
name: Dummy name: Dummy
id: Dummy id: Dummy
@@ -28,7 +28,7 @@ namespace Content.IntegrationTests.Tests.DoAfter
public async Task TestFinished() public async Task TestFinished()
{ {
Task<DoAfterStatus> task = null; Task<DoAfterStatus> task = null;
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
// That it finishes successfully // That it finishes successfully
@@ -52,7 +52,7 @@ namespace Content.IntegrationTests.Tests.DoAfter
public async Task TestCancelled() public async Task TestCancelled()
{ {
Task<DoAfterStatus> task = null; Task<DoAfterStatus> task = null;
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
server.Post(() => server.Post(() =>

View File

@@ -14,17 +14,35 @@ namespace Content.IntegrationTests.Tests.Doors
[TestOf(typeof(AirlockComponent))] [TestOf(typeof(AirlockComponent))]
public class AirlockTest : ContentIntegrationTest 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 - type: entity
name: AirlockDummy name: AirlockDummy
id: AirlockDummy id: AirlockDummy
components: components:
- type: Airlock - type: Airlock
- type: Physics
shapes:
- !type:PhysShapeAabb
bounds: ""-0.49,-0.49,0.49,0.49""
mask:
- Impassable
"; ";
[Test] [Test]
public async Task OpenCloseDestroyTest() public async Task OpenCloseDestroyTest()
{ {
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
await server.WaitIdleAsync(); await server.WaitIdleAsync();
@@ -39,7 +57,7 @@ namespace Content.IntegrationTests.Tests.Doors
{ {
mapManager.CreateNewMapEntity(MapId.Nullspace); mapManager.CreateNewMapEntity(MapId.Nullspace);
airlock = entityManager.SpawnEntity("Airlock", MapCoordinates.Nullspace); airlock = entityManager.SpawnEntity("AirlockDummy", MapCoordinates.Nullspace);
Assert.True(airlock.TryGetComponent(out airlockComponent)); Assert.True(airlock.TryGetComponent(out airlockComponent));
Assert.That(airlockComponent.State, Is.EqualTo(DoorState.Closed)); Assert.That(airlockComponent.State, Is.EqualTo(DoorState.Closed));
@@ -85,7 +103,7 @@ namespace Content.IntegrationTests.Tests.Doors
[Test] [Test]
public async Task AirlockBlockTest() public async Task AirlockBlockTest()
{ {
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes};
var server = StartServer(options); var server = StartServer(options);
await server.WaitIdleAsync(); await server.WaitIdleAsync();
@@ -93,24 +111,24 @@ namespace Content.IntegrationTests.Tests.Doors
var mapManager = server.ResolveDependency<IMapManager>(); var mapManager = server.ResolveDependency<IMapManager>();
var entityManager = server.ResolveDependency<IEntityManager>(); var entityManager = server.ResolveDependency<IEntityManager>();
IEntity human = null; IEntity physicsDummy = null;
IEntity airlock = null; IEntity airlock = null;
TestController controller = null; TestController controller = null;
AirlockComponent airlockComponent = null; AirlockComponent airlockComponent = null;
var humanStartingX = -1; var physicsDummyStartingX = -1;
server.Assert(() => server.Assert(() =>
{ {
var mapId = new MapId(1); var mapId = new MapId(1);
mapManager.CreateNewMapEntity(mapId); mapManager.CreateNewMapEntity(mapId);
var humanCoordinates = new MapCoordinates((humanStartingX, 0), mapId); var humanCoordinates = new MapCoordinates((physicsDummyStartingX, 0), mapId);
human = entityManager.SpawnEntity("HumanMob_Content", humanCoordinates); 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<TestController>(); controller = physics.EnsureController<TestController>();
@@ -136,10 +154,10 @@ namespace Content.IntegrationTests.Tests.Doors
} }
// Sanity check // Sanity check
Assert.That(human.Transform.MapPosition.X, Is.GreaterThan(humanStartingX)); Assert.That(physicsDummy.Transform.MapPosition.X, Is.GreaterThan(physicsDummyStartingX));
// Blocked by the airlock // 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 { } private class TestController : VirtualController { }

View File

@@ -27,7 +27,7 @@ namespace Content.IntegrationTests.Tests
{ {
if (!proto.Components.ContainsKey("Sprite")) continue; if (!proto.Components.ContainsKey("Sprite")) continue;
SpriteComponent.GetPrototypeTextures(proto, resourceCache).ToList(); var _ = SpriteComponent.GetPrototypeTextures(proto, resourceCache).ToList();
} }
}); });
} }

View File

@@ -118,11 +118,10 @@ namespace Content.IntegrationTests.Tests.Fluids
var sEntityManager = server.ResolveDependency<IEntityManager>(); var sEntityManager = server.ResolveDependency<IEntityManager>();
MapId sMapId = default; MapId sMapId = default;
IMapGrid sGrid = null; IMapGrid sGrid;
GridId sGridId = default; GridId sGridId = default;
IEntity sGridEntity = null; IEntity sGridEntity = null;
EntityCoordinates sCoordinates = default; EntityCoordinates sCoordinates = default;
TimerComponent sTimerComponent = null;
// Spawn a paused map with one tile to spawn puddles on // Spawn a paused map with one tile to spawn puddles on
await server.WaitPost(() => await server.WaitPost(() =>
@@ -170,7 +169,7 @@ namespace Content.IntegrationTests.Tests.Fluids
Assert.Positive(sPuddle.EvaporateTime); Assert.Positive(sPuddle.EvaporateTime);
// Should have a timer component added to it for evaporation // 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; sEvaporateTime = sPuddle.EvaporateTime;
sPuddleStartingVolume = sPuddle.CurrentVolume; sPuddleStartingVolume = sPuddle.CurrentVolume;
@@ -184,7 +183,7 @@ namespace Content.IntegrationTests.Tests.Fluids
await server.WaitAssertion(() => await server.WaitAssertion(() =>
{ {
Assert.True(sPuddle.Owner.Paused); 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 // Check that the puddle still exists
Assert.False(sPuddle.Owner.Deleted); Assert.False(sPuddle.Owner.Deleted);

View File

@@ -3,7 +3,6 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Content.Client.GameObjects.Components.Items; using Content.Client.GameObjects.Components.Items;
using Content.Server.GameObjects.Components.ActionBlocking; using Content.Server.GameObjects.Components.ActionBlocking;
using Content.Server.GameObjects.Components.Body;
using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Shared.GameObjects.Components.Body; using Content.Shared.GameObjects.Components.Body;
using NUnit.Framework; using NUnit.Framework;
@@ -20,7 +19,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
[TestOf(typeof(HandcuffComponent))] [TestOf(typeof(HandcuffComponent))]
public class HandCuffTest : ContentIntegrationTest public class HandCuffTest : ContentIntegrationTest
{ {
private const string PROTOTYPES = @" private const string Prototypes = @"
- type: entity - type: entity
name: HumanDummy name: HumanDummy
id: HumanDummy id: HumanDummy
@@ -41,18 +40,15 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
[Test] [Test]
public async Task Test() public async Task Test()
{ {
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
IEntity human; IEntity human;
IEntity otherHuman; IEntity otherHuman;
IEntity cuffs; IEntity cuffs;
IEntity secondCuffs; IEntity secondCuffs;
HandcuffComponent handcuff;
HandcuffComponent secondHandcuff;
CuffableComponent cuffed; CuffableComponent cuffed;
IHandsComponent hands; IHandsComponent hands;
IBody body;
server.Assert(() => server.Assert(() =>
{ {
@@ -72,9 +68,9 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
// Test for components existing // Test for components existing
Assert.True(human.TryGetComponent(out cuffed!), $"Human has no {nameof(CuffableComponent)}"); 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 hands!), $"Human has no {nameof(HandsComponent)}");
Assert.True(human.TryGetComponent(out body!), $"Human has no {nameof(IBody)}"); Assert.True(human.TryGetComponent(out IBody _), $"Human has no {nameof(IBody)}");
Assert.True(cuffs.TryGetComponent(out handcuff!), $"Handcuff has no {nameof(HandcuffComponent)}"); Assert.True(cuffs.TryGetComponent(out HandcuffComponent _), $"Handcuff has no {nameof(HandcuffComponent)}");
Assert.True(secondCuffs.TryGetComponent(out secondHandcuff!), $"Second handcuffs has no {nameof(HandcuffComponent)}"); Assert.True(secondCuffs.TryGetComponent(out HandcuffComponent _), $"Second handcuffs has no {nameof(HandcuffComponent)}");
// Test to ensure cuffed players register the handcuffs // Test to ensure cuffed players register the handcuffs
cuffed.TryAddNewCuffs(human, cuffs); cuffed.TryAddNewCuffs(human, cuffs);

View File

@@ -8,14 +8,14 @@ using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Mobs;
using Content.Shared.Actions; using Content.Shared.Actions;
using Content.Shared.GameObjects.Components.Mobs; using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.Utility;
using NUnit.Framework; using NUnit.Framework;
using Robust.Client.Interfaces.UserInterface; using Robust.Client.Interfaces.UserInterface;
using Robust.Client.Player; using Robust.Client.Player;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Map;
using Content.Shared.Utility;
using Robust.Shared.Interfaces.Timing; using Robust.Shared.Interfaces.Timing;
using Robust.Shared.Map;
using Robust.Shared.Utility; using Robust.Shared.Utility;
namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
@@ -27,7 +27,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
[TestOf(typeof(ItemActionsComponent))] [TestOf(typeof(ItemActionsComponent))]
public class ActionsComponentTests : ContentIntegrationTest public class ActionsComponentTests : ContentIntegrationTest
{ {
const string PROTOTYPES = @" const string Prototypes = @"
- type: entity - type: entity
name: flashlight name: flashlight
parent: BaseItem parent: BaseItem
@@ -72,7 +72,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
{ {
var player = serverPlayerManager.GetAllPlayers().Single(); var player = serverPlayerManager.GetAllPlayers().Single();
var playerEnt = player.AttachedEntity; var playerEnt = player.AttachedEntity;
var actionsComponent = playerEnt.GetComponent<ServerActionsComponent>(); var actionsComponent = playerEnt!.GetComponent<ServerActionsComponent>();
// player should begin with their innate actions granted // player should begin with their innate actions granted
innateActions.AddRange(actionsComponent.InnateActions); innateActions.AddRange(actionsComponent.InnateActions);
@@ -94,12 +94,12 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
var clientPlayerMgr = client.ResolveDependency<IPlayerManager>(); var clientPlayerMgr = client.ResolveDependency<IPlayerManager>();
var clientUIMgr = client.ResolveDependency<IUserInterfaceManager>(); var clientUIMgr = client.ResolveDependency<IUserInterfaceManager>();
var expectedOrder = new List<ActionType>(); var expectedOrder = new List<ActionType>();
await client.WaitAssertion(() => await client.WaitAssertion(() =>
{ {
var local = clientPlayerMgr.LocalPlayer; var local = clientPlayerMgr.LocalPlayer;
var controlled = local.ControlledEntity; var controlled = local!.ControlledEntity;
var actionsComponent = controlled.GetComponent<ClientActionsComponent>(); var actionsComponent = controlled!.GetComponent<ClientActionsComponent>();
// we should have our innate actions and debug1. // we should have our innate actions and debug1.
foreach (var innateAction in innateActions) foreach (var innateAction in innateActions)
@@ -155,7 +155,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
{ {
var player = serverPlayerManager.GetAllPlayers().Single(); var player = serverPlayerManager.GetAllPlayers().Single();
var playerEnt = player.AttachedEntity; var playerEnt = player.AttachedEntity;
var actionsComponent = playerEnt.GetComponent<ServerActionsComponent>(); var actionsComponent = playerEnt!.GetComponent<ServerActionsComponent>();
actionsComponent.Revoke(ActionType.DebugInstant); actionsComponent.Revoke(ActionType.DebugInstant);
}); });
@@ -164,10 +164,9 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
await client.WaitAssertion(() => await client.WaitAssertion(() =>
{ {
var local = clientPlayerMgr.LocalPlayer; var local = clientPlayerMgr.LocalPlayer;
var controlled = local.ControlledEntity; var controlled = local!.ControlledEntity;
var actionsComponent = controlled.GetComponent<ClientActionsComponent>(); var actionsComponent = controlled!.GetComponent<ClientActionsComponent>();
// we should have our innate actions, but debug1 should be revoked // we should have our innate actions, but debug1 should be revoked
foreach (var innateAction in innateActions) 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(actionsComponent.TryGetActionState(innateAction, out var innateState));
Assert.That(innateState.Enabled); 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 // all actions should be in the same order as before, but the slot with DebugInstant should appear
// disabled. // disabled.
@@ -195,6 +194,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
Assert.That(slot.Action, Is.Not.Null); Assert.That(slot.Action, Is.Not.Null);
var asAction = slot.Action as ActionPrototype; var asAction = slot.Action as ActionPrototype;
Assert.That(asAction, Is.Not.Null); Assert.That(asAction, Is.Not.Null);
Assert.That(expected, Is.EqualTo(asAction.ActionType));
if (asAction.ActionType == ActionType.DebugInstant) 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.Item, Is.Null);
Assert.That(slot.Action, Is.Null); Assert.That(slot.Action, Is.Null);
Assert.That(slot.ActionEnabled, Is.False); Assert.That(slot.ActionEnabled, Is.False);
continue;
} }
} }
}); });
@@ -220,8 +219,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
[Test] [Test]
public async Task GrantsAndRevokesItemActions() public async Task GrantsAndRevokesItemActions()
{ {
var serverOptions = new ServerIntegrationOptions { ExtraPrototypes = PROTOTYPES }; var serverOptions = new ServerIntegrationOptions { ExtraPrototypes = Prototypes };
var clientOptions = new ClientIntegrationOptions { ExtraPrototypes = PROTOTYPES }; var clientOptions = new ClientIntegrationOptions { ExtraPrototypes = Prototypes };
var (client, server) = await StartConnectedServerClientPair(serverOptions: serverOptions, clientOptions: clientOptions); var (client, server) = await StartConnectedServerClientPair(serverOptions: serverOptions, clientOptions: clientOptions);
await server.WaitIdleAsync(); await server.WaitIdleAsync();
@@ -241,7 +240,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
await server.WaitAssertion(() => await server.WaitAssertion(() =>
{ {
serverPlayerEnt = serverPlayerManager.GetAllPlayers().Single().AttachedEntity; serverPlayerEnt = serverPlayerManager.GetAllPlayers().Single().AttachedEntity;
serverActionsComponent = serverPlayerEnt.GetComponent<ServerActionsComponent>(); serverActionsComponent = serverPlayerEnt!.GetComponent<ServerActionsComponent>();
// spawn and give them an item that has actions // spawn and give them an item that has actions
serverFlashlight = serverEntManager.SpawnEntity("TestFlashlight", 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 // check that client has the actions, and toggle the light on via the action slot it was auto-assigned to
var clientPlayerMgr = client.ResolveDependency<IPlayerManager>(); var clientPlayerMgr = client.ResolveDependency<IPlayerManager>();
var clientUIMgr = client.ResolveDependency<IUserInterfaceManager>(); var clientUIMgr = client.ResolveDependency<IUserInterfaceManager>();
var clientEntMgr = client.ResolveDependency<IEntityManager>();
EntityUid clientFlashlight = default; EntityUid clientFlashlight = default;
await client.WaitAssertion(() => await client.WaitAssertion(() =>
{ {
var local = clientPlayerMgr.LocalPlayer; var local = clientPlayerMgr.LocalPlayer;
var controlled = local.ControlledEntity; var controlled = local!.ControlledEntity;
clientActionsComponent = controlled.GetComponent<ClientActionsComponent>(); clientActionsComponent = controlled!.GetComponent<ClientActionsComponent>();
var lightEntry = clientActionsComponent.ItemActionStates() var lightEntry = clientActionsComponent.ItemActionStates()
.Where(entry => entry.Value.ContainsKey(ItemActionType.ToggleLight)) .Where(entry => entry.Value.ContainsKey(ItemActionType.ToggleLight))
.FirstOrNull(); .FirstOrNull();
clientFlashlight = lightEntry.Value.Key; clientFlashlight = lightEntry!.Value.Key;
Assert.That(lightEntry, Is.Not.Null); Assert.That(lightEntry, Is.Not.Null);
Assert.That(lightEntry.Value.Value.TryGetValue(ItemActionType.ToggleLight, out var lightState)); Assert.That(lightEntry.Value.Value.TryGetValue(ItemActionType.ToggleLight, out var lightState));
Assert.That(lightState.Equals(new ActionState(true))); Assert.That(lightState.Equals(new ActionState(true)));

View File

@@ -17,7 +17,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
[TestOf(typeof(ClimbingComponent))] [TestOf(typeof(ClimbingComponent))]
public class ClimbUnitTest : ContentIntegrationTest public class ClimbUnitTest : ContentIntegrationTest
{ {
private const string PROTOTYPES = @" private const string Prototypes = @"
- type: entity - type: entity
name: HumanDummy name: HumanDummy
id: HumanDummy id: HumanDummy
@@ -35,12 +35,11 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
[Test] [Test]
public async Task Test() public async Task Test()
{ {
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
IEntity human; IEntity human;
IEntity table; IEntity table;
ClimbableComponent climbable;
ClimbingComponent climbing; ClimbingComponent climbing;
server.Assert(() => server.Assert(() =>
@@ -56,20 +55,20 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
// Test for climb components existing // Test for climb components existing
// Players and tables should have these in their prototypes. // Players and tables should have these in their prototypes.
Assert.That(human.TryGetComponent(out climbing!), "Human has no climbing", Is.True); Assert.That(human.TryGetComponent(out climbing!), "Human has no climbing");
Assert.That(table.TryGetComponent(out climbable!), "Table has no climbable", Is.True); Assert.That(table.TryGetComponent(out ClimbableComponent _), "Table has no climbable");
// Now let's make the player enter a climbing transitioning state. // Now let's make the player enter a climbing transitioning state.
climbing.IsClimbing = true; climbing.IsClimbing = true;
climbing.TryMoveTo(human.Transform.WorldPosition, table.Transform.WorldPosition); climbing.TryMoveTo(human.Transform.WorldPosition, table.Transform.WorldPosition);
var body = human.GetComponent<IPhysicsComponent>(); var body = human.GetComponent<IPhysicsComponent>();
Assert.That(body.HasController<ClimbController>(), "Player has no ClimbController", Is.True); Assert.That(body.HasController<ClimbController>(), "Player has no ClimbController");
// Force the player out of climb state. It should immediately remove the ClimbController. // Force the player out of climb state. It should immediately remove the ClimbController.
climbing.IsClimbing = false; climbing.IsClimbing = false;
Assert.That(!body.HasController<ClimbController>(), "Player wrongly has a ClimbController", Is.True); Assert.That(!body.HasController<ClimbController>(), "Player wrongly has a ClimbController");
}); });

View File

@@ -6,7 +6,6 @@ using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.EntitySystems; using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Utility; using Content.Shared.Utility;
using NUnit.Framework; using NUnit.Framework;
using Robust.Server.Interfaces.Timing;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map; using Robust.Shared.Interfaces.Map;
@@ -19,7 +18,7 @@ namespace Content.IntegrationTests.Tests.Gravity
[TestOf(typeof(GravityGeneratorComponent))] [TestOf(typeof(GravityGeneratorComponent))]
public class WeightlessStatusTests : ContentIntegrationTest public class WeightlessStatusTests : ContentIntegrationTest
{ {
private const string PROTOTYPES = @" private const string Prototypes = @"
- type: entity - type: entity
name: HumanDummy name: HumanDummy
id: HumanDummy id: HumanDummy
@@ -29,15 +28,13 @@ namespace Content.IntegrationTests.Tests.Gravity
[Test] [Test]
public async Task WeightlessStatusTest() public async Task WeightlessStatusTest()
{ {
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
var server = StartServer(options); var server = StartServer(options);
await server.WaitIdleAsync(); await server.WaitIdleAsync();
var mapManager = server.ResolveDependency<IMapManager>(); var mapManager = server.ResolveDependency<IMapManager>();
var entityManager = server.ResolveDependency<IEntityManager>(); var entityManager = server.ResolveDependency<IEntityManager>();
var pauseManager = server.ResolveDependency<IPauseManager>();
var tileDefinitionManager = server.ResolveDependency<ITileDefinitionManager>();
IEntity human = null; IEntity human = null;
SharedAlertsComponent alerts = null; SharedAlertsComponent alerts = null;

View File

@@ -17,7 +17,7 @@ namespace Content.IntegrationTests.Tests
[TestOf(typeof(GravityGeneratorComponent))] [TestOf(typeof(GravityGeneratorComponent))]
public class GravityGridTest : ContentIntegrationTest public class GravityGridTest : ContentIntegrationTest
{ {
private const string PROTOTYPES = @" private const string Prototypes = @"
- type: entity - type: entity
name: GravityGeneratorDummy name: GravityGeneratorDummy
id: GravityGeneratorDummy id: GravityGeneratorDummy
@@ -28,7 +28,7 @@ namespace Content.IntegrationTests.Tests
[Test] [Test]
public async Task Test() public async Task Test()
{ {
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
IEntity generator = null; IEntity generator = null;

View File

@@ -13,7 +13,7 @@ namespace Content.IntegrationTests.Tests
[TestFixture] [TestFixture]
public class GridTileLookupTest : ContentIntegrationTest public class GridTileLookupTest : ContentIntegrationTest
{ {
private const string PROTOTYPES = @" private const string Prototypes = @"
- type: entity - type: entity
name: Dummy name: Dummy
id: Dummy id: Dummy
@@ -22,7 +22,7 @@ namespace Content.IntegrationTests.Tests
[Test] [Test]
public async Task Test() public async Task Test()
{ {
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
await server.WaitIdleAsync(); await server.WaitIdleAsync();

View File

@@ -16,7 +16,7 @@ namespace Content.IntegrationTests.Tests
[TestOf(typeof(HumanInventoryControllerComponent))] [TestOf(typeof(HumanInventoryControllerComponent))]
public class HumanInventoryUniformSlotsTest : ContentIntegrationTest public class HumanInventoryUniformSlotsTest : ContentIntegrationTest
{ {
private const string PROTOTYPES = @" private const string Prototypes = @"
- type: entity - type: entity
name: HumanDummy name: HumanDummy
id: HumanDummy id: HumanDummy
@@ -59,7 +59,7 @@ namespace Content.IntegrationTests.Tests
[Test] [Test]
public async Task Test() public async Task Test()
{ {
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
IEntity human = null; IEntity human = null;

View File

@@ -16,7 +16,7 @@ namespace Content.IntegrationTests.Tests
[TestOf(typeof(InventoryHelpers))] [TestOf(typeof(InventoryHelpers))]
public class InventoryHelpersTest : ContentIntegrationTest public class InventoryHelpersTest : ContentIntegrationTest
{ {
private const string PROTOTYPES = @" private const string Prototypes = @"
- type: entity - type: entity
name: InventoryStunnableDummy name: InventoryStunnableDummy
id: InventoryStunnableDummy id: InventoryStunnableDummy
@@ -45,7 +45,7 @@ namespace Content.IntegrationTests.Tests
[Test] [Test]
public async Task SpawnItemInSlotTest() public async Task SpawnItemInSlotTest()
{ {
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions {ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
IEntity human = null; IEntity human = null;
@@ -83,7 +83,7 @@ namespace Content.IntegrationTests.Tests
Assert.That(inventory.TryGetSlotItem(Slots.IDCARD, out ItemComponent _), Is.False); Assert.That(inventory.TryGetSlotItem(Slots.IDCARD, out ItemComponent _), Is.False);
// Let's try skipping the interaction check and see if it equips it! // 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(inventory.TryGetSlotItem(Slots.IDCARD, out ItemComponent id));
Assert.That(id.Owner.Prototype != null && id.Owner.Prototype.ID == "InventoryIDCardDummy"); Assert.That(id.Owner.Prototype != null && id.Owner.Prototype.ID == "InventoryIDCardDummy");
}); });

View File

@@ -15,7 +15,7 @@ namespace Content.IntegrationTests.Tests
[TestFixture] [TestFixture]
public class PowerTest : ContentIntegrationTest public class PowerTest : ContentIntegrationTest
{ {
private const string PROTOTYPES = @" private const string Prototypes = @"
- type: entity - type: entity
name: GeneratorDummy name: GeneratorDummy
id: GeneratorDummy id: GeneratorDummy
@@ -118,7 +118,7 @@ namespace Content.IntegrationTests.Tests
[Test] [Test]
public async Task PowerNetTest() public async Task PowerNetTest()
{ {
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
PowerSupplierComponent supplier = null; PowerSupplierComponent supplier = null;
@@ -169,7 +169,7 @@ namespace Content.IntegrationTests.Tests
[Test] [Test]
public async Task ApcChargingTest() public async Task ApcChargingTest()
{ {
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
BatteryComponent apcBattery = null; BatteryComponent apcBattery = null;
@@ -217,7 +217,7 @@ namespace Content.IntegrationTests.Tests
[Test] [Test]
public async Task ApcNetTest() public async Task ApcNetTest()
{ {
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; var options = new ServerIntegrationOptions{ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
PowerReceiverComponent receiver = null; PowerReceiverComponent receiver = null;

View File

@@ -16,7 +16,7 @@ namespace Content.IntegrationTests.Tests.Pulling
[TestOf(typeof(PullController))] [TestOf(typeof(PullController))]
public class PullTest : ContentIntegrationTest public class PullTest : ContentIntegrationTest
{ {
private const string PROTOTYPES = @" private const string Prototypes = @"
- type: entity - type: entity
name: PullTestPullerDummy name: PullTestPullerDummy
id: PullTestPullerDummy id: PullTestPullerDummy
@@ -35,7 +35,7 @@ namespace Content.IntegrationTests.Tests.Pulling
[Test] [Test]
public async Task AnchoredNoPullTest() public async Task AnchoredNoPullTest()
{ {
var options = new ServerContentIntegrationOption {ExtraPrototypes = PROTOTYPES}; var options = new ServerContentIntegrationOption {ExtraPrototypes = Prototypes};
var server = StartServerDummyTicker(options); var server = StartServerDummyTicker(options);
await server.WaitIdleAsync(); await server.WaitIdleAsync();

View File

@@ -30,7 +30,7 @@ namespace Content.IntegrationTests.Tests
mapLoader.SaveBlueprint(new GridId(1), "save load save 1.yml"); mapLoader.SaveBlueprint(new GridId(1), "save load save 1.yml");
var mapId = mapManager.CreateMap(); var mapId = mapManager.CreateMap();
var grid = mapLoader.LoadBlueprint(mapId, "save load save 1.yml"); 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(); await server.WaitIdleAsync();