Fix content.integration tests warnings (#17817)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.IntegrationTests.Tests.Interaction;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Construction.Interaction;
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.IntegrationTests.Tests.Interaction;
|
||||
using Content.Shared.Stacks;
|
||||
using NUnit.Framework;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Construction.Interaction;
|
||||
@@ -80,48 +78,67 @@ public sealed class CraftingTests : InteractionTest
|
||||
|
||||
await RunTicks(5);
|
||||
var sys = SEntMan.System<SharedContainerSystem>();
|
||||
Assert.That(sys.IsEntityInContainer(rods), Is.False);
|
||||
Assert.That(sys.IsEntityInContainer(wires), Is.False);
|
||||
Assert.That(sys.IsEntityInContainer(shard), Is.False);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(sys.IsEntityInContainer(rods), Is.False);
|
||||
Assert.That(sys.IsEntityInContainer(wires), Is.False);
|
||||
Assert.That(sys.IsEntityInContainer(shard), Is.False);
|
||||
});
|
||||
|
||||
#pragma warning disable CS4014 // Legacy construction code uses DoAfterAwait. If we await it we will be waiting forever.
|
||||
await Server.WaitPost(() => SConstruction.TryStartItemConstruction(Spear, Player));
|
||||
#pragma warning restore CS4014
|
||||
await RunTicks(1);
|
||||
|
||||
// DoAfter is in progress. Entity not spawned, stacks have been split and someingredients are in a container.
|
||||
Assert.That(ActiveDoAfters.Count(), Is.EqualTo(1));
|
||||
Assert.That(sys.IsEntityInContainer(shard), Is.True);
|
||||
Assert.That(sys.IsEntityInContainer(rods), Is.False);
|
||||
Assert.That(sys.IsEntityInContainer(wires), Is.False);
|
||||
Assert.That(rodStack.Count, Is.EqualTo(8));
|
||||
Assert.That(wireStack.Count, Is.EqualTo(8));
|
||||
await FindEntity(Spear, shouldSucceed: false);
|
||||
Assert.Multiple(async () =>
|
||||
{
|
||||
Assert.That(ActiveDoAfters.Count(), Is.EqualTo(1));
|
||||
Assert.That(sys.IsEntityInContainer(shard), Is.True);
|
||||
Assert.That(sys.IsEntityInContainer(rods), Is.False);
|
||||
Assert.That(sys.IsEntityInContainer(wires), Is.False);
|
||||
Assert.That(rodStack, Has.Count.EqualTo(8));
|
||||
Assert.That(wireStack, Has.Count.EqualTo(8));
|
||||
|
||||
await FindEntity(Spear, shouldSucceed: false);
|
||||
});
|
||||
|
||||
// Cancel the DoAfter. Should drop ingredients to the floor.
|
||||
await CancelDoAfters();
|
||||
Assert.That(sys.IsEntityInContainer(rods), Is.False);
|
||||
Assert.That(sys.IsEntityInContainer(wires), Is.False);
|
||||
Assert.That(sys.IsEntityInContainer(shard), Is.False);
|
||||
await FindEntity(Spear, shouldSucceed: false);
|
||||
await AssertEntityLookup((Rod, 10), (Cable, 10), (ShardGlass, 1));
|
||||
Assert.Multiple(async () =>
|
||||
{
|
||||
Assert.That(sys.IsEntityInContainer(rods), Is.False);
|
||||
Assert.That(sys.IsEntityInContainer(wires), Is.False);
|
||||
Assert.That(sys.IsEntityInContainer(shard), Is.False);
|
||||
await FindEntity(Spear, shouldSucceed: false);
|
||||
await AssertEntityLookup((Rod, 10), (Cable, 10), (ShardGlass, 1));
|
||||
});
|
||||
|
||||
// Re-attempt the do-after
|
||||
#pragma warning disable CS4014 // Legacy construction code uses DoAfterAwait. See above.
|
||||
await Server.WaitPost(() => SConstruction.TryStartItemConstruction(Spear, Player));
|
||||
#pragma warning restore CS4014
|
||||
await RunTicks(1);
|
||||
|
||||
// DoAfter is in progress. Entity not spawned, ingredients are in a container.
|
||||
Assert.That(ActiveDoAfters.Count(), Is.EqualTo(1));
|
||||
Assert.That(sys.IsEntityInContainer(shard), Is.True);
|
||||
await FindEntity(Spear, shouldSucceed: false);
|
||||
Assert.Multiple(async () =>
|
||||
{
|
||||
Assert.That(ActiveDoAfters.Count(), Is.EqualTo(1));
|
||||
Assert.That(sys.IsEntityInContainer(shard), Is.True);
|
||||
await FindEntity(Spear, shouldSucceed: false);
|
||||
});
|
||||
|
||||
// Finish the DoAfter
|
||||
await AwaitDoAfters();
|
||||
|
||||
// Spear has been crafted. Rods and wires are no longer contained. Glass has been consumed.
|
||||
await FindEntity(Spear);
|
||||
Assert.That(sys.IsEntityInContainer(rods), Is.False);
|
||||
Assert.That(sys.IsEntityInContainer(wires), Is.False);
|
||||
Assert.That(SEntMan.Deleted(shard));
|
||||
Assert.Multiple(async () =>
|
||||
{
|
||||
await FindEntity(Spear);
|
||||
Assert.That(sys.IsEntityInContainer(rods), Is.False);
|
||||
Assert.That(sys.IsEntityInContainer(wires), Is.False);
|
||||
Assert.That(SEntMan.Deleted(shard));
|
||||
});
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.IntegrationTests.Tests.Interaction;
|
||||
using Content.Shared.Construction.Prototypes;
|
||||
using NUnit.Framework;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Construction.Interaction;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.IntegrationTests.Tests.Interaction;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Construction.Interaction;
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.IntegrationTests.Tests.Interaction;
|
||||
using Content.Shared.Wires;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Construction.Interaction;
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.IntegrationTests.Tests.Interaction;
|
||||
using Content.Shared.Placeable;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Construction.Interaction;
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.IntegrationTests.Tests.Interaction;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Construction.Interaction;
|
||||
|
||||
@@ -15,10 +13,10 @@ public sealed class WallConstruction : InteractionTest
|
||||
{
|
||||
await StartConstruction(Wall);
|
||||
await Interact(Steel, 2);
|
||||
Assert.IsNull(Hands.ActiveHandEntity);
|
||||
Assert.That(Hands.ActiveHandEntity, Is.Null);
|
||||
AssertPrototype(Girder);
|
||||
await Interact(Steel, 2);
|
||||
Assert.IsNull(Hands.ActiveHandEntity);
|
||||
Assert.That(Hands.ActiveHandEntity, Is.Null);
|
||||
AssertPrototype(WallSolid);
|
||||
}
|
||||
|
||||
@@ -33,4 +31,3 @@ public sealed class WallConstruction : InteractionTest
|
||||
await AssertEntityLookup((Steel, 4));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.IntegrationTests.Tests.Interaction;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Construction.Interaction;
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.IntegrationTests.Tests.Interaction;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.FixedPoint;
|
||||
using NUnit.Framework;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Construction.Interaction;
|
||||
|
||||
Reference in New Issue
Block a user