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

@@ -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);