Fix content.integration tests warnings (#17817)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.IntegrationTests.Tests.Interaction;
|
||||
using Content.Shared.Radio.Components;
|
||||
using Content.Shared.Wires;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.EncryptionKeys;
|
||||
|
||||
@@ -15,26 +13,35 @@ public sealed class RemoveEncryptionKeys : InteractionTest
|
||||
await SpawnTarget("ClothingHeadsetGrey");
|
||||
var comp = Comp<EncryptionKeyHolderComponent>();
|
||||
|
||||
Assert.That(comp.KeyContainer.ContainedEntities.Count, Is.EqualTo(1));
|
||||
Assert.That(comp.DefaultChannel, Is.EqualTo("Common"));
|
||||
Assert.That(comp.Channels.Count, Is.EqualTo(1));
|
||||
Assert.That(comp.Channels.First(), Is.EqualTo("Common"));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(comp.KeyContainer.ContainedEntities, Has.Count.EqualTo(1));
|
||||
Assert.That(comp.DefaultChannel, Is.EqualTo("Common"));
|
||||
Assert.That(comp.Channels, Has.Count.EqualTo(1));
|
||||
Assert.That(comp.Channels.First(), Is.EqualTo("Common"));
|
||||
});
|
||||
|
||||
// Remove the key
|
||||
await Interact(Screw);
|
||||
Assert.That(comp.KeyContainer.ContainedEntities.Count, Is.EqualTo(0));
|
||||
Assert.IsNull(comp.DefaultChannel);
|
||||
Assert.That(comp.Channels.Count, Is.EqualTo(0));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(comp.KeyContainer.ContainedEntities, Has.Count.EqualTo(0));
|
||||
Assert.That(comp.DefaultChannel, Is.Null);
|
||||
Assert.That(comp.Channels, Has.Count.EqualTo(0));
|
||||
});
|
||||
|
||||
// Checkl that the key was ejected and not just deleted or something.
|
||||
await AssertEntityLookup(("EncryptionKeyCommon", 1));
|
||||
|
||||
// Re-insert a key.
|
||||
await Interact("EncryptionKeyCentCom");
|
||||
Assert.That(comp.KeyContainer.ContainedEntities.Count, Is.EqualTo(1));
|
||||
Assert.That(comp.DefaultChannel, Is.EqualTo("CentCom"));
|
||||
Assert.That(comp.Channels.Count, Is.EqualTo(1));
|
||||
Assert.That(comp.Channels.First(), Is.EqualTo("CentCom"));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(comp.KeyContainer.ContainedEntities, Has.Count.EqualTo(1));
|
||||
Assert.That(comp.DefaultChannel, Is.EqualTo("CentCom"));
|
||||
Assert.That(comp.Channels, Has.Count.EqualTo(1));
|
||||
Assert.That(comp.Channels.First(), Is.EqualTo("CentCom"));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -44,40 +51,58 @@ public sealed class RemoveEncryptionKeys : InteractionTest
|
||||
var comp = Comp<EncryptionKeyHolderComponent>();
|
||||
var panel = Comp<WiresPanelComponent>();
|
||||
|
||||
Assert.That(comp.KeyContainer.ContainedEntities.Count, Is.GreaterThan(0));
|
||||
Assert.That(comp.Channels.Count, Is.GreaterThan(0));
|
||||
Assert.That(panel.Open, Is.False);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(comp.KeyContainer.ContainedEntities, Has.Count.GreaterThan(0));
|
||||
Assert.That(comp.Channels, Has.Count.GreaterThan(0));
|
||||
Assert.That(panel.Open, Is.False);
|
||||
});
|
||||
|
||||
// cannot remove keys without opening panel
|
||||
await Interact(Pry);
|
||||
Assert.That(comp.KeyContainer.ContainedEntities.Count, Is.GreaterThan(0));
|
||||
Assert.That(comp.Channels.Count, Is.GreaterThan(0));
|
||||
Assert.That(panel.Open, Is.False);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(comp.KeyContainer.ContainedEntities, Has.Count.GreaterThan(0));
|
||||
Assert.That(comp.Channels, Has.Count.GreaterThan(0));
|
||||
Assert.That(panel.Open, Is.False);
|
||||
});
|
||||
|
||||
// Open panel
|
||||
await Interact(Screw);
|
||||
Assert.That(panel.Open, Is.True);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(panel.Open, Is.True);
|
||||
|
||||
// Keys are still here
|
||||
Assert.That(comp.KeyContainer.ContainedEntities.Count, Is.GreaterThan(0));
|
||||
Assert.That(comp.Channels.Count, Is.GreaterThan(0));
|
||||
// Keys are still here
|
||||
Assert.That(comp.KeyContainer.ContainedEntities, Has.Count.GreaterThan(0));
|
||||
Assert.That(comp.Channels, Has.Count.GreaterThan(0));
|
||||
});
|
||||
|
||||
// Now remove the keys
|
||||
await Interact(Pry);
|
||||
Assert.That(comp.KeyContainer.ContainedEntities.Count, Is.EqualTo(0));
|
||||
Assert.That(comp.Channels.Count, Is.EqualTo(0));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(comp.KeyContainer.ContainedEntities, Has.Count.EqualTo(0));
|
||||
Assert.That(comp.Channels, Has.Count.EqualTo(0));
|
||||
});
|
||||
|
||||
// Reinsert a key
|
||||
await Interact("EncryptionKeyCentCom");
|
||||
Assert.That(comp.KeyContainer.ContainedEntities.Count, Is.EqualTo(1));
|
||||
Assert.That(comp.DefaultChannel, Is.EqualTo("CentCom"));
|
||||
Assert.That(comp.Channels.Count, Is.EqualTo(1));
|
||||
Assert.That(comp.Channels.First(), Is.EqualTo("CentCom"));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(comp.KeyContainer.ContainedEntities, Has.Count.EqualTo(1));
|
||||
Assert.That(comp.DefaultChannel, Is.EqualTo("CentCom"));
|
||||
Assert.That(comp.Channels, Has.Count.EqualTo(1));
|
||||
Assert.That(comp.Channels.First(), Is.EqualTo("CentCom"));
|
||||
});
|
||||
|
||||
// Remove it again
|
||||
await Interact(Pry);
|
||||
Assert.That(comp.KeyContainer.ContainedEntities.Count, Is.EqualTo(0));
|
||||
Assert.That(comp.Channels.Count, Is.EqualTo(0));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(comp.KeyContainer.ContainedEntities, Has.Count.EqualTo(0));
|
||||
Assert.That(comp.Channels, Has.Count.EqualTo(0));
|
||||
});
|
||||
|
||||
// Prying again will start deconstructing the machine.
|
||||
AssertPrototype("TelecomServerFilled");
|
||||
@@ -85,4 +110,3 @@ public sealed class RemoveEncryptionKeys : InteractionTest
|
||||
AssertPrototype("MachineFrame");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user