diff --git a/Content.IntegrationTests/Content.IntegrationTests.csproj b/Content.IntegrationTests/Content.IntegrationTests.csproj
index 34ef2a0290f..5f2a5b0cebb 100644
--- a/Content.IntegrationTests/Content.IntegrationTests.csproj
+++ b/Content.IntegrationTests/Content.IntegrationTests.csproj
@@ -24,4 +24,5 @@
+
diff --git a/Content.IntegrationTests/DummyParallaxManager.cs b/Content.IntegrationTests/DummyParallaxManager.cs
index 91c739fa742..2daa682673f 100644
--- a/Content.IntegrationTests/DummyParallaxManager.cs
+++ b/Content.IntegrationTests/DummyParallaxManager.cs
@@ -1,5 +1,3 @@
-using System;
-using System.Threading.Tasks;
using Content.Client.Parallax.Managers;
using Content.Client.Parallax;
using Robust.Shared.Maths;
diff --git a/Content.IntegrationTests/GlobalUsings.cs b/Content.IntegrationTests/GlobalUsings.cs
new file mode 100644
index 00000000000..8422c5c3cdc
--- /dev/null
+++ b/Content.IntegrationTests/GlobalUsings.cs
@@ -0,0 +1,5 @@
+// Global usings for Content.IntegrationTests
+
+global using NUnit.Framework;
+global using System;
+global using System.Threading.Tasks;
diff --git a/Content.IntegrationTests/PoolManager.cs b/Content.IntegrationTests/PoolManager.cs
index 026ac68a0a8..09f7ffd945a 100644
--- a/Content.IntegrationTests/PoolManager.cs
+++ b/Content.IntegrationTests/PoolManager.cs
@@ -1,10 +1,8 @@
-using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
-using System.Threading.Tasks;
using Content.Client.IoC;
using Content.Client.Parallax.Managers;
using Content.IntegrationTests.Tests;
@@ -14,8 +12,6 @@
using Content.IntegrationTests.Tests.Networking;
using Content.Server.GameTicking;
using Content.Shared.CCVar;
-using Microsoft.Diagnostics.Tracing.Parsers.Kernel;
-using NUnit.Framework;
using Robust.Client;
using Robust.Server;
using Robust.Shared;
@@ -61,13 +57,13 @@ private static readonly (string cvar, string value)[] ServerTestCvars =
// @formatter:on
};
- private static int PairId;
- private static object PairLock = new();
+ private static int _pairId;
+ private static readonly object PairLock = new();
// Pair, IsBorrowed
- private static Dictionary Pairs = new();
- private static bool Dead;
- private static Exception PoolFailureReason;
+ private static readonly Dictionary Pairs = new();
+ private static bool _dead;
+ private static Exception _poolFailureReason;
private static async Task ConfigurePrototypes(RobustIntegrationTest.IntegrationInstance instance,
PoolSettings settings)
@@ -108,18 +104,21 @@ await instance.WaitPost(() =>
options.BeforeStart += () =>
{
- IoCManager.Resolve()
- .LoadExtraSystemType();
- IoCManager.Resolve().RegisterClass();
+ var entSysMan = IoCManager.Resolve();
+ var compFactory = IoCManager.Resolve();
+ entSysMan.LoadExtraSystemType();
+ compFactory.RegisterClass();
+ entSysMan.LoadExtraSystemType();
+ compFactory.RegisterClass();
+ entSysMan.LoadExtraSystemType();
+ compFactory.RegisterClass();
IoCManager.Register();
IoCManager.Register();
IoCManager.Register();
- IoCManager.Resolve()
- .LoadExtraSystemType();
- IoCManager.Resolve()
- .LoadExtraSystemType();
- IoCManager.Resolve().LoadExtraSystemType();
- IoCManager.Resolve().LoadExtraSystemType();
+ entSysMan.LoadExtraSystemType();
+ entSysMan.LoadExtraSystemType();
+ entSysMan.LoadExtraSystemType();
+ entSysMan.LoadExtraSystemType();
IoCManager.Resolve().GetSawmill("loc").Level = LogLevel.Error;
IoCManager.Resolve()
.OnValueChanged(RTCVars.FailureLogLevel, value => logHandler.FailureLevel = value, true);
@@ -141,9 +140,9 @@ public static void Shutdown()
List localPairs;
lock (PairLock)
{
- if(Dead)
+ if (_dead)
return;
- Dead = true;
+ _dead = true;
localPairs = Pairs.Keys.ToList();
}
@@ -163,7 +162,7 @@ public static string DeathReport()
{
var borrowed = Pairs[pair];
builder.AppendLine($"Pair {pair.PairId}, Tests Run: {pair.TestHistory.Count}, Borrowed: {borrowed}");
- for (int i = 0; i < pair.TestHistory.Count; i++)
+ for (var i = 0; i < pair.TestHistory.Count; i++)
{
builder.AppendLine($"#{i}: {pair.TestHistory[i]}");
}
@@ -211,10 +210,14 @@ public static string DeathReport()
{
ClientBeforeIoC = () =>
{
- IoCManager.Resolve()
- .LoadExtraSystemType();
- IoCManager.Resolve()
- .RegisterClass();
+ var entSysMan = IoCManager.Resolve();
+ var compFactory = IoCManager.Resolve();
+ entSysMan.LoadExtraSystemType();
+ compFactory.RegisterClass();
+ entSysMan.LoadExtraSystemType();
+ compFactory.RegisterClass();
+ entSysMan.LoadExtraSystemType();
+ compFactory.RegisterClass();
IoCManager.Register(true);
IoCManager.Resolve().GetSawmill("loc").Level = LogLevel.Error;
IoCManager.Resolve()
@@ -232,9 +235,9 @@ public static string DeathReport()
private static void SetupCVars(PoolSettings poolSettings, RobustIntegrationTest.IntegrationOptions options)
{
- foreach (var serverTestCvar in ServerTestCvars)
+ foreach (var (cvar, value) in ServerTestCvars)
{
- options.CVarOverrides[serverTestCvar.cvar] = serverTestCvar.value;
+ options.CVarOverrides[cvar] = value;
}
if (poolSettings.DummyTicker)
@@ -266,8 +269,10 @@ private static void SetupCVars(PoolSettings poolSettings, RobustIntegrationTest.
///
/// See
///
- public static async Task GetServerClient(PoolSettings poolSettings = null) =>
- await GetServerClientPair(poolSettings ?? new PoolSettings());
+ public static async Task GetServerClient(PoolSettings poolSettings = null)
+ {
+ return await GetServerClientPair(poolSettings ?? new PoolSettings());
+ }
private static string GetDefaultTestName(TestContext testContext)
{
@@ -328,7 +333,7 @@ await testOut.WriteLineAsync(
if (pair != null && pair.TestHistory.Count > 1)
{
await testOut.WriteLineAsync($"{nameof(GetServerClientPair)}: Pair {pair.PairId} Test History Start");
- for (int i = 0; i < pair.TestHistory.Count; i++)
+ for (var i = 0; i < pair.TestHistory.Count; i++)
{
await testOut.WriteLineAsync($"- Pair {pair.PairId} Test #{i}: {pair.TestHistory[i]}");
}
@@ -403,6 +408,8 @@ private static async Task CleanPooledPair(PoolSettings poolSettings, Pair pair,
methodWatch.Start();
await testOut.WriteLineAsync($"Recycling: {methodWatch.Elapsed.TotalMilliseconds} ms: Setting CVar ");
var configManager = pair.Server.ResolveDependency();
+ var entityManager = pair.Server.ResolveDependency();
+ var gameTicker = entityManager.System();
await pair.Server.WaitPost(() =>
{
configManager.SetCVar(CCVars.GameLobbyEnabled, poolSettings.InLobby);
@@ -414,14 +421,14 @@ await pair.Server.WaitPost(() =>
pair.Client.SetConnectTarget(pair.Server);
await pair.Server.WaitPost(() =>
{
- EntitySystem.Get().RestartRound();
+ gameTicker.RestartRound();
});
await pair.Client.WaitPost(() =>
{
cNetMgr.ClientConnect(null!, 0, null!);
});
}
- await ReallyBeIdle(pair,11);
+ await ReallyBeIdle(pair, 11);
await testOut.WriteLineAsync($"Recycling: {methodWatch.Elapsed.TotalMilliseconds} ms: Disconnecting client, and restarting server");
@@ -443,7 +450,7 @@ await pair.Server.WaitPost(() =>
serverProtoManager.RemoveString(pair.Settings.ExtraPrototypes.Trim());
});
}
- if(!pair.Settings.NoClient)
+ if (!pair.Settings.NoClient)
{
var clientProtoManager = pair.Client.ResolveDependency();
await pair.Client.WaitPost(() =>
@@ -471,7 +478,7 @@ await pair.Client.WaitPost(() =>
await testOut.WriteLineAsync($"Recycling: {methodWatch.Elapsed.TotalMilliseconds} ms: Restarting server again");
await pair.Server.WaitPost(() =>
{
- EntitySystem.Get().RestartRound();
+ gameTicker.RestartRound();
});
@@ -495,17 +502,17 @@ await pair.Client.WaitPost(() =>
private static void DieIfPoolFailure()
{
- if (PoolFailureReason != null)
+ if (_poolFailureReason != null)
{
- // If the PoolFailureReason is not null, we can assume at least one test failed.
+ // If the _poolFailureReason is not null, we can assume at least one test failed.
// So we say inconclusive so we don't add more failed tests to search through.
Assert.Inconclusive(@"
In a different test, the pool manager had an exception when trying to create a server/client pair.
Instead of risking that the pool manager will fail at creating a server/client pairs for every single test,
-we are just going to end this here to save a lot of time. This is the exception that started this:\n {0}", PoolFailureReason);
+we are just going to end this here to save a lot of time. This is the exception that started this:\n {0}", _poolFailureReason);
}
- if (Dead)
+ if (_dead)
{
// If Pairs is null, we ran out of time, we can't assume a test failed.
// So we are going to tell it all future tests are a failure.
@@ -525,12 +532,12 @@ private static async Task CreateServerClientPair(PoolSettings poolSettings
ServerLogHandler = serverLog,
Client = client,
ClientLogHandler = clientLog,
- PairId = Interlocked.Increment(ref PairId)
+ PairId = Interlocked.Increment(ref _pairId)
};
}
catch (Exception ex)
{
- PoolFailureReason = ex;
+ _poolFailureReason = ex;
throw;
}
@@ -565,6 +572,8 @@ public static async Task CreateTestMap(PairTracker pairTracker)
var settings = pairTracker.Pair.Settings;
var mapManager = server.ResolveDependency();
var tileDefinitionManager = server.ResolveDependency();
+ var entityManager = server.ResolveDependency();
+ var xformSystem = entityManager.System();
if (settings.NoServer) throw new Exception("Cannot setup test map without server");
var mapData = new TestMapData();
@@ -573,7 +582,7 @@ await server.WaitPost(() =>
mapData.MapId = mapManager.CreateMap();
mapData.MapUid = mapManager.GetMapEntityId(mapData.MapId);
mapData.MapGrid = mapManager.CreateGrid(mapData.MapId);
- mapData.GridUid = mapData.MapGrid.Owner;
+ mapData.GridUid = mapData.MapGrid.Owner; // Fixing this requires an engine PR.
mapData.GridCoords = new EntityCoordinates(mapData.GridUid, 0, 0);
var plating = tileDefinitionManager["Plating"];
var platingTile = new Tile(plating.TileId);
@@ -610,11 +619,11 @@ public static async Task RunTicksSync(Pair pair, int ticks)
/// How many ticks to run
public static async Task ReallyBeIdle(Pair pair, int runTicks = 25)
{
- for (int i = 0; i < runTicks; i++)
+ for (var i = 0; i < runTicks; i++)
{
await pair.Client.WaitRunTicks(1);
await pair.Server.WaitRunTicks(1);
- for (int idleCycles = 0; idleCycles < 4; idleCycles++)
+ for (var idleCycles = 0; idleCycles < 4; idleCycles++)
{
await pair.Client.WaitIdleAsync();
await pair.Server.WaitIdleAsync();
@@ -809,7 +818,9 @@ public bool CanFastRecycle(PoolSettings nextSettings)
// Prototype hot reload is not available outside TOOLS builds,
// so we can't pool test instances that use ExtraPrototypes without TOOLS.
#if TOOLS
+#pragma warning disable CA1822 // Can't be marked as static b/c the other branch exists but Omnisharp can't see both.
private bool NoToolsExtraPrototypes => false;
+#pragma warning restore CA1822
#else
private bool NoToolsExtraPrototypes => !string.IsNullOrEmpty(ExtraPrototypes);
#endif
diff --git a/Content.IntegrationTests/PoolManagerTestEventHandler.cs b/Content.IntegrationTests/PoolManagerTestEventHandler.cs
index 1bdb1541f48..e21ba8b1754 100644
--- a/Content.IntegrationTests/PoolManagerTestEventHandler.cs
+++ b/Content.IntegrationTests/PoolManagerTestEventHandler.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Threading.Tasks;
-using NUnit.Framework;
-
+
[assembly: Parallelizable(ParallelScope.Children)]
namespace Content.IntegrationTests;
diff --git a/Content.IntegrationTests/PoolTestLogHandler.cs b/Content.IntegrationTests/PoolTestLogHandler.cs
index 2dcb40c6031..efa185e148c 100644
--- a/Content.IntegrationTests/PoolTestLogHandler.cs
+++ b/Content.IntegrationTests/PoolTestLogHandler.cs
@@ -1,6 +1,4 @@
-using System;
-using System.IO;
-using NUnit.Framework;
+using System.IO;
using Robust.Shared.Log;
using Robust.Shared.Timing;
using Serilog.Events;
diff --git a/Content.IntegrationTests/Tests/Access/AccessReaderTest.cs b/Content.IntegrationTests/Tests/Access/AccessReaderTest.cs
index 6b4df318b4f..b5074008a6e 100644
--- a/Content.IntegrationTests/Tests/Access/AccessReaderTest.cs
+++ b/Content.IntegrationTests/Tests/Access/AccessReaderTest.cs
@@ -1,8 +1,6 @@
using System.Collections.Generic;
-using System.Threading.Tasks;
using Content.Shared.Access.Components;
using Content.Shared.Access.Systems;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
namespace Content.IntegrationTests.Tests.Access
@@ -14,63 +12,82 @@ public sealed class AccessReaderTest
[Test]
public async Task TestTags()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
+ var entityManager = server.ResolveDependency();
await server.WaitAssertion(() =>
{
- var system = EntitySystem.Get();
+ var system = entityManager.System();
// test empty
var reader = new AccessReaderComponent();
- Assert.That(system.AreAccessTagsAllowed(new[] { "Foo" }, reader), Is.True);
- Assert.That(system.AreAccessTagsAllowed(new[] { "Bar" }, reader), Is.True);
- Assert.That(system.AreAccessTagsAllowed(new string[] { }, reader), Is.True);
+ Assert.Multiple(() =>
+ {
+ Assert.That(system.AreAccessTagsAllowed(new[] { "Foo" }, reader), Is.True);
+ Assert.That(system.AreAccessTagsAllowed(new[] { "Bar" }, reader), Is.True);
+ Assert.That(system.AreAccessTagsAllowed(Array.Empty(), reader), Is.True);
+ });
// test deny
reader = new AccessReaderComponent();
reader.DenyTags.Add("A");
- Assert.That(system.AreAccessTagsAllowed(new[] { "Foo" }, reader), Is.True);
- Assert.That(system.AreAccessTagsAllowed(new[] { "A" }, reader), Is.False);
- Assert.That(system.AreAccessTagsAllowed(new[] { "A", "Foo" }, reader), Is.False);
- Assert.That(system.AreAccessTagsAllowed(new string[] { }, reader), Is.True);
+ Assert.Multiple(() =>
+ {
+ Assert.That(system.AreAccessTagsAllowed(new[] { "Foo" }, reader), Is.True);
+ Assert.That(system.AreAccessTagsAllowed(new[] { "A" }, reader), Is.False);
+ Assert.That(system.AreAccessTagsAllowed(new[] { "A", "Foo" }, reader), Is.False);
+ Assert.That(system.AreAccessTagsAllowed(Array.Empty(), reader), Is.True);
+ });
// test one list
reader = new AccessReaderComponent();
reader.AccessLists.Add(new HashSet { "A" });
- Assert.That(system.AreAccessTagsAllowed(new[] { "A" }, reader), Is.True);
- Assert.That(system.AreAccessTagsAllowed(new[] { "B" }, reader), Is.False);
- Assert.That(system.AreAccessTagsAllowed(new[] { "A", "B" }, reader), Is.True);
- Assert.That(system.AreAccessTagsAllowed(new string[] { }, reader), Is.False);
+ Assert.Multiple(() =>
+ {
+ Assert.That(system.AreAccessTagsAllowed(new[] { "A" }, reader), Is.True);
+ Assert.That(system.AreAccessTagsAllowed(new[] { "B" }, reader), Is.False);
+ Assert.That(system.AreAccessTagsAllowed(new[] { "A", "B" }, reader), Is.True);
+ Assert.That(system.AreAccessTagsAllowed(Array.Empty(), reader), Is.False);
+ });
// test one list - two items
reader = new AccessReaderComponent();
reader.AccessLists.Add(new HashSet { "A", "B" });
- Assert.That(system.AreAccessTagsAllowed(new[] { "A" }, reader), Is.False);
- Assert.That(system.AreAccessTagsAllowed(new[] { "B" }, reader), Is.False);
- Assert.That(system.AreAccessTagsAllowed(new[] { "A", "B" }, reader), Is.True);
- Assert.That(system.AreAccessTagsAllowed(new string[] { }, reader), Is.False);
+ Assert.Multiple(() =>
+ {
+ Assert.That(system.AreAccessTagsAllowed(new[] { "A" }, reader), Is.False);
+ Assert.That(system.AreAccessTagsAllowed(new[] { "B" }, reader), Is.False);
+ Assert.That(system.AreAccessTagsAllowed(new[] { "A", "B" }, reader), Is.True);
+ Assert.That(system.AreAccessTagsAllowed(Array.Empty(), reader), Is.False);
+ });
// test two list
reader = new AccessReaderComponent();
reader.AccessLists.Add(new HashSet { "A" });
reader.AccessLists.Add(new HashSet { "B", "C" });
- Assert.That(system.AreAccessTagsAllowed(new[] { "A" }, reader), Is.True);
- Assert.That(system.AreAccessTagsAllowed(new[] { "B" }, reader), Is.False);
- Assert.That(system.AreAccessTagsAllowed(new[] { "A", "B" }, reader), Is.True);
- Assert.That(system.AreAccessTagsAllowed(new[] { "C", "B" }, reader), Is.True);
- Assert.That(system.AreAccessTagsAllowed(new[] { "C", "B", "A" }, reader), Is.True);
- Assert.That(system.AreAccessTagsAllowed(new string[] { }, reader), Is.False);
+ Assert.Multiple(() =>
+ {
+ Assert.That(system.AreAccessTagsAllowed(new[] { "A" }, reader), Is.True);
+ Assert.That(system.AreAccessTagsAllowed(new[] { "B" }, reader), Is.False);
+ Assert.That(system.AreAccessTagsAllowed(new[] { "A", "B" }, reader), Is.True);
+ Assert.That(system.AreAccessTagsAllowed(new[] { "C", "B" }, reader), Is.True);
+ Assert.That(system.AreAccessTagsAllowed(new[] { "C", "B", "A" }, reader), Is.True);
+ Assert.That(system.AreAccessTagsAllowed(Array.Empty(), reader), Is.False);
+ });
// test deny list
reader = new AccessReaderComponent();
reader.AccessLists.Add(new HashSet { "A" });
reader.DenyTags.Add("B");
- Assert.That(system.AreAccessTagsAllowed(new[] { "A" }, reader), Is.True);
- Assert.That(system.AreAccessTagsAllowed(new[] { "B" }, reader), Is.False);
- Assert.That(system.AreAccessTagsAllowed(new[] { "A", "B" }, reader), Is.False);
- Assert.That(system.AreAccessTagsAllowed(new string[] { }, reader), Is.False);
+ Assert.Multiple(() =>
+ {
+ Assert.That(system.AreAccessTagsAllowed(new[] { "A" }, reader), Is.True);
+ Assert.That(system.AreAccessTagsAllowed(new[] { "B" }, reader), Is.False);
+ Assert.That(system.AreAccessTagsAllowed(new[] { "A", "B" }, reader), Is.False);
+ Assert.That(system.AreAccessTagsAllowed(Array.Empty(), reader), Is.False);
+ });
});
await pairTracker.CleanReturnAsync();
}
diff --git a/Content.IntegrationTests/Tests/Administration/Logs/AddTests.cs b/Content.IntegrationTests/Tests/Administration/Logs/AddTests.cs
index 59322d9fc19..42366824017 100644
--- a/Content.IntegrationTests/Tests/Administration/Logs/AddTests.cs
+++ b/Content.IntegrationTests/Tests/Administration/Logs/AddTests.cs
@@ -1,7 +1,5 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
-using System.Threading.Tasks;
using Content.Server.Administration.Logs;
using Content.Server.Database;
using Content.Server.GameTicking;
@@ -9,7 +7,6 @@
using Content.Shared.Administration.Logs;
using Content.Shared.CCVar;
using Content.Shared.Database;
-using NUnit.Framework;
using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
@@ -24,7 +21,7 @@ public sealed class AddTests
[Test]
public async Task AddAndGetSingleLog()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
var sEntities = server.ResolveDependency();
@@ -71,7 +68,7 @@ await PoolManager.WaitUntil(server, async () =>
[Test]
public async Task AddAndGetUnformattedLog()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
var sDatabase = server.ResolveDependency();
@@ -115,15 +112,18 @@ await PoolManager.WaitUntil(server, async () =>
{
Round = sGamerTicker.RoundId,
Search = log.Message,
- Types = new HashSet {log.Type},
+ Types = new HashSet { log.Type },
};
await foreach (var json in sDatabase.GetAdminLogsJson(filter))
{
var root = json.RootElement;
- Assert.That(root.TryGetProperty("entity", out _), Is.True);
- Assert.That(root.TryGetProperty("guid", out _), Is.True);
+ Assert.Multiple(() =>
+ {
+ Assert.That(root.TryGetProperty("entity", out _), Is.True);
+ Assert.That(root.TryGetProperty("guid", out _), Is.True);
+ });
json.Dispose();
}
@@ -135,7 +135,7 @@ await PoolManager.WaitUntil(server, async () =>
[TestCase(500)]
public async Task BulkAddLogs(int amount)
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
var sEntities = server.ResolveDependency();
@@ -204,7 +204,7 @@ await PoolManager.WaitUntil(server, async () =>
[Test]
public async Task PreRoundAddAndGetSingle()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{Dirty = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { Dirty = true });
var server = pairTracker.Pair.Server;
var configManager = server.ResolveDependency();
@@ -255,7 +255,7 @@ await PoolManager.WaitUntil(server, async () =>
{
Round = sGamerTicker.RoundId,
Search = log.Message,
- Types = new HashSet {log.Type},
+ Types = new HashSet { log.Type },
};
await foreach (var json in sDatabase.GetAdminLogsJson(filter))
diff --git a/Content.IntegrationTests/Tests/Administration/Logs/FilterTests.cs b/Content.IntegrationTests/Tests/Administration/Logs/FilterTests.cs
index f67817ac65e..d02790d7626 100644
--- a/Content.IntegrationTests/Tests/Administration/Logs/FilterTests.cs
+++ b/Content.IntegrationTests/Tests/Administration/Logs/FilterTests.cs
@@ -1,12 +1,7 @@
-using System;
-using System.Threading.Tasks;
using Content.Server.Administration.Logs;
using Content.Shared.Administration.Logs;
-using Content.Shared.CCVar;
using Content.Shared.Database;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
-using Robust.Shared.Map;
namespace Content.IntegrationTests.Tests.Administration.Logs;
@@ -19,7 +14,7 @@ public sealed class FilterTests
[TestCase(DateOrder.Descending)]
public async Task Date(DateOrder order)
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
var sEntities = server.ResolveDependency();
diff --git a/Content.IntegrationTests/Tests/Administration/Logs/QueryTests.cs b/Content.IntegrationTests/Tests/Administration/Logs/QueryTests.cs
index 4805ce20cef..7f5de897e1f 100644
--- a/Content.IntegrationTests/Tests/Administration/Logs/QueryTests.cs
+++ b/Content.IntegrationTests/Tests/Administration/Logs/QueryTests.cs
@@ -1,12 +1,8 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
-using System.Threading.Tasks;
using Content.Server.Administration.Logs;
using Content.Server.GameTicking;
-using Content.Shared.CCVar;
using Content.Shared.Database;
-using NUnit.Framework;
using Robust.Server.Player;
using Robust.Shared.GameObjects;
@@ -44,9 +40,9 @@ await server.WaitPost(() =>
{
Round = sGamerTicker.RoundId,
Search = guid.ToString(),
- Types = new HashSet {LogType.Unknown},
+ Types = new HashSet { LogType.Unknown },
After = date,
- AnyPlayers = new[] {player.UserId.UserId}
+ AnyPlayers = new[] { player.UserId.UserId }
};
await PoolManager.WaitUntil(server, async () =>
diff --git a/Content.IntegrationTests/Tests/Atmos/AlarmThresholdTest.cs b/Content.IntegrationTests/Tests/Atmos/AlarmThresholdTest.cs
index fb483ebe75b..663cb27758b 100644
--- a/Content.IntegrationTests/Tests/Atmos/AlarmThresholdTest.cs
+++ b/Content.IntegrationTests/Tests/Atmos/AlarmThresholdTest.cs
@@ -1,6 +1,4 @@
-using System.Threading.Tasks;
using Content.Shared.Atmos.Monitor;
-using NUnit.Framework;
using Robust.Shared.Prototypes;
namespace Content.IntegrationTests.Tests.Atmos
@@ -25,7 +23,7 @@ public sealed class AlarmThresholdTest
[Test]
public async Task TestAlarmThreshold()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true, ExtraPrototypes = Prototypes });
var server = pairTracker.Pair.Server;
var prototypeManager = server.ResolveDependency();
@@ -39,8 +37,11 @@ await server.WaitPost(() =>
await server.WaitAssertion(() =>
{
// ensure upper/lower bounds are calculated
- Assert.That(threshold.UpperWarningBound.Value, Is.EqualTo(5f * 0.5f));
- Assert.That(threshold.LowerWarningBound.Value, Is.EqualTo(1f * 1.5f));
+ Assert.Multiple(() =>
+ {
+ Assert.That(threshold.UpperWarningBound.Value, Is.EqualTo(5f * 0.5f));
+ Assert.That(threshold.LowerWarningBound.Value, Is.EqualTo(1f * 1.5f));
+ });
// ensure that setting bounds to zero/
// negative numbers is an invalid set
@@ -102,7 +103,7 @@ await server.WaitAssertion(() =>
threshold.SetEnabled(AtmosMonitorLimitType.LowerWarning, true);
// Check a value that's in between each upper/lower warning/panic:
- threshold.CheckThreshold(3f, out AtmosAlarmType alarmType);
+ threshold.CheckThreshold(3f, out var alarmType);
Assert.That(alarmType, Is.EqualTo(AtmosAlarmType.Normal));
threshold.CheckThreshold(1.5f, out alarmType);
Assert.That(alarmType, Is.EqualTo(AtmosAlarmType.Warning));
diff --git a/Content.IntegrationTests/Tests/Atmos/ConstantsTest.cs b/Content.IntegrationTests/Tests/Atmos/ConstantsTest.cs
index 6eba112b2f2..adcd3a38eaf 100644
--- a/Content.IntegrationTests/Tests/Atmos/ConstantsTest.cs
+++ b/Content.IntegrationTests/Tests/Atmos/ConstantsTest.cs
@@ -1,9 +1,6 @@
-using System;
-using System.Linq;
-using System.Threading.Tasks;
+using System.Linq;
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Atmos;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
namespace Content.IntegrationTests.Tests.Atmos
@@ -15,16 +12,19 @@ public sealed class ConstantsTest
[Test]
public async Task TotalGasesTest()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
+ var entityManager = server.ResolveDependency();
await server.WaitPost(() =>
{
- var atmosSystem = EntitySystem.Get();
+ var atmosSystem = entityManager.System();
- Assert.That(atmosSystem.Gases.Count(), Is.EqualTo(Atmospherics.TotalNumberOfGases));
-
- Assert.That(Enum.GetValues(typeof(Gas)).Length, Is.EqualTo(Atmospherics.TotalNumberOfGases));
+ Assert.Multiple(() =>
+ {
+ Assert.That(atmosSystem.Gases.Count(), Is.EqualTo(Atmospherics.TotalNumberOfGases));
+ Assert.That(Enum.GetValues(typeof(Gas)), Has.Length.EqualTo(Atmospherics.TotalNumberOfGases));
+ });
});
await pairTracker.CleanReturnAsync();
}
diff --git a/Content.IntegrationTests/Tests/Atmos/GasMixtureTest.cs b/Content.IntegrationTests/Tests/Atmos/GasMixtureTest.cs
index 1302dc9f4b9..cc74d5e675c 100644
--- a/Content.IntegrationTests/Tests/Atmos/GasMixtureTest.cs
+++ b/Content.IntegrationTests/Tests/Atmos/GasMixtureTest.cs
@@ -1,8 +1,6 @@
-using System.Threading.Tasks;
-using Content.Server.Atmos;
+using Content.Server.Atmos;
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Atmos;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
namespace Content.IntegrationTests.Tests.Atmos
@@ -14,7 +12,7 @@ public sealed class GasMixtureTest
[Test]
public async Task TestMerge()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
var atmosphereSystem = server.ResolveDependency().GetEntitySystem();
@@ -28,23 +26,35 @@ await server.WaitAssertion(() =>
b.AdjustMoles(Gas.Nitrogen, 50);
// a now has 50 moles of oxygen
- Assert.That(a.TotalMoles, Is.EqualTo(50));
- Assert.That(a.GetMoles(Gas.Oxygen), Is.EqualTo(50));
+ Assert.Multiple(() =>
+ {
+ Assert.That(a.TotalMoles, Is.EqualTo(50));
+ Assert.That(a.GetMoles(Gas.Oxygen), Is.EqualTo(50));
+ });
// b now has 50 moles of nitrogen
- Assert.That(b.TotalMoles, Is.EqualTo(50));
- Assert.That(b.GetMoles(Gas.Nitrogen), Is.EqualTo(50));
+ Assert.Multiple(() =>
+ {
+ Assert.That(b.TotalMoles, Is.EqualTo(50));
+ Assert.That(b.GetMoles(Gas.Nitrogen), Is.EqualTo(50));
+ });
atmosphereSystem.Merge(b, a);
// b now has its contents and the contents of a
- Assert.That(b.TotalMoles, Is.EqualTo(100));
- Assert.That(b.GetMoles(Gas.Oxygen), Is.EqualTo(50));
- Assert.That(b.GetMoles(Gas.Nitrogen), Is.EqualTo(50));
+ Assert.Multiple(() =>
+ {
+ Assert.That(b.TotalMoles, Is.EqualTo(100));
+ Assert.That(b.GetMoles(Gas.Oxygen), Is.EqualTo(50));
+ Assert.That(b.GetMoles(Gas.Nitrogen), Is.EqualTo(50));
+ });
// a should be the same, however.
- Assert.That(a.TotalMoles, Is.EqualTo(50));
- Assert.That(a.GetMoles(Gas.Oxygen), Is.EqualTo(50));
+ Assert.Multiple(() =>
+ {
+ Assert.That(a.TotalMoles, Is.EqualTo(50));
+ Assert.That(a.GetMoles(Gas.Oxygen), Is.EqualTo(50));
+ });
});
await pairTracker.CleanReturnAsync();
@@ -59,7 +69,7 @@ await server.WaitAssertion(() =>
[TestCase(Atmospherics.BreathPercentage)]
public async Task RemoveRatio(float ratio)
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
await server.WaitAssertion(() =>
@@ -75,14 +85,23 @@ await server.WaitAssertion(() =>
var b = a.RemoveRatio(ratio);
// check that the amount of moles in the original and the new mixture are correct.
- Assert.That(b.TotalMoles, Is.EqualTo(origTotal * ratio));
- Assert.That(a.TotalMoles, Is.EqualTo(origTotal - b.TotalMoles));
-
- Assert.That(b.GetMoles(Gas.Oxygen), Is.EqualTo(100 * ratio));
- Assert.That(b.GetMoles(Gas.Nitrogen), Is.EqualTo(100 * ratio));
-
- Assert.That(a.GetMoles(Gas.Oxygen), Is.EqualTo(100 - b.GetMoles(Gas.Oxygen)));
- Assert.That(a.GetMoles(Gas.Nitrogen), Is.EqualTo(100 - b.GetMoles(Gas.Nitrogen)));
+ Assert.Multiple(() =>
+ {
+ Assert.That(b.TotalMoles, Is.EqualTo(origTotal * ratio));
+ Assert.That(a.TotalMoles, Is.EqualTo(origTotal - b.TotalMoles));
+ });
+
+ Assert.Multiple(() =>
+ {
+ Assert.That(b.GetMoles(Gas.Oxygen), Is.EqualTo(100 * ratio));
+ Assert.That(b.GetMoles(Gas.Nitrogen), Is.EqualTo(100 * ratio));
+ });
+
+ Assert.Multiple(() =>
+ {
+ Assert.That(a.GetMoles(Gas.Oxygen), Is.EqualTo(100 - b.GetMoles(Gas.Oxygen)));
+ Assert.That(a.GetMoles(Gas.Nitrogen), Is.EqualTo(100 - b.GetMoles(Gas.Nitrogen)));
+ });
});
await pairTracker.CleanReturnAsync();
diff --git a/Content.IntegrationTests/Tests/Body/LegTest.cs b/Content.IntegrationTests/Tests/Body/LegTest.cs
index 3930e3dfb34..cd5fa23da0c 100644
--- a/Content.IntegrationTests/Tests/Body/LegTest.cs
+++ b/Content.IntegrationTests/Tests/Body/LegTest.cs
@@ -1,11 +1,8 @@
-using System.Threading.Tasks;
-using Content.Server.Body.Systems;
+using Content.Server.Body.Systems;
using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Content.Shared.Rotation;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
@@ -31,24 +28,34 @@ public sealed class LegTest
public async Task RemoveLegsFallTest()
{
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
- {NoClient = true, ExtraPrototypes = Prototypes});
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
+ EntityUid human = default!;
AppearanceComponent appearance = null;
+
var entityManager = server.ResolveDependency();
var mapManager = server.ResolveDependency();
+ var appearanceSystem = entityManager.System();
await server.WaitAssertion(() =>
{
var mapId = mapManager.CreateMap();
+ BodyComponent body = null;
- var human = entityManager.SpawnEntity("HumanBodyAndAppearanceDummy",
+ human = entityManager.SpawnEntity("HumanBodyAndAppearanceDummy",
new MapCoordinates(Vector2.Zero, mapId));
- Assert.That(entityManager.TryGetComponent(human, out BodyComponent body));
- Assert.That(entityManager.TryGetComponent(human, out appearance));
+ Assert.Multiple(() =>
+ {
+ Assert.That(entityManager.TryGetComponent(human, out body));
+ Assert.That(entityManager.TryGetComponent(human, out appearance));
+ });
- Assert.That(!appearance.TryGetData(RotationVisuals.RotationState, out RotationState _));
+ Assert.That(!appearanceSystem.TryGetData(human, RotationVisuals.RotationState, out RotationState _, appearance));
var bodySystem = entityManager.System();
var legs = bodySystem.GetBodyChildrenOfType(human, BodyPartType.Leg, body);
@@ -61,8 +68,11 @@ await server.WaitAssertion(() =>
await server.WaitAssertion(() =>
{
- Assert.That(appearance.TryGetData(RotationVisuals.RotationState, out RotationState state));
+#pragma warning disable NUnit2045
+ // Interdependent assertions.
+ Assert.That(appearanceSystem.TryGetData(human, RotationVisuals.RotationState, out RotationState state, appearance));
Assert.That(state, Is.EqualTo(RotationState.Horizontal));
+#pragma warning restore NUnit2045
});
await pairTracker.CleanReturnAsync();
}
diff --git a/Content.IntegrationTests/Tests/Body/LungTest.cs b/Content.IntegrationTests/Tests/Body/LungTest.cs
index 7cb54d39371..637740d64d4 100644
--- a/Content.IntegrationTests/Tests/Body/LungTest.cs
+++ b/Content.IntegrationTests/Tests/Body/LungTest.cs
@@ -1,16 +1,16 @@
-using System.Threading.Tasks;
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Shared.Body.Components;
-using NUnit.Framework;
using Robust.Server.GameObjects;
using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
+using Robust.Shared.Map.Components;
using Robust.Shared.Maths;
+using System.Linq;
namespace Content.IntegrationTests.Tests.Body
{
@@ -52,7 +52,10 @@ public async Task AirConsistencyTest()
{
// --- Setup
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
- {NoClient = true, ExtraPrototypes = Prototypes});
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
await server.WaitIdleAsync();
@@ -68,17 +71,22 @@ public async Task AirConsistencyTest()
BodyComponent body = default;
EntityUid human = default;
GridAtmosphereComponent relevantAtmos = default;
- float startingMoles = 0.0f;
+ var startingMoles = 0.0f;
var testMapName = "Maps/Test/Breathing/3by3-20oxy-80nit.yml";
await server.WaitPost(() =>
{
mapId = mapManager.CreateMap();
- grid = mapLoader.LoadGrid(mapId, testMapName);
+ Assert.That(mapLoader.TryLoad(mapId, testMapName, out var roots));
+
+ var query = entityManager.GetEntityQuery();
+ var grids = roots.Where(x => query.HasComponent(x));
+ Assert.That(grids, Is.Not.Empty);
+ grid = grids.First();
});
- Assert.NotNull(grid, $"Test blueprint {testMapName} not found.");
+ Assert.That(grid, Is.Not.Null, $"Test blueprint {testMapName} not found.");
float GetMapMoles()
{
@@ -96,13 +104,15 @@ await server.WaitAssertion(() =>
var coords = new Vector2(0.5f, -1f);
var coordinates = new EntityCoordinates(grid.Value, coords);
human = entityManager.SpawnEntity("HumanBodyDummy", coordinates);
- respSys = EntitySystem.Get();
- metaSys = EntitySystem.Get();
+ respSys = entityManager.System();
+ metaSys = entityManager.System();
relevantAtmos = entityManager.GetComponent(grid.Value);
startingMoles = GetMapMoles();
- Assert.True(entityManager.TryGetComponent(human, out body));
- Assert.True(entityManager.HasComponent(human));
+#pragma warning disable NUnit2045
+ Assert.That(entityManager.TryGetComponent(human, out body), Is.True);
+ Assert.That(entityManager.HasComponent(human), Is.True);
+#pragma warning restore NUnit2045
});
// --- End setup
@@ -131,7 +141,10 @@ await server.WaitAssertion(() =>
public async Task NoSuffocationTest()
{
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
- {NoClient = true, ExtraPrototypes = Prototypes});
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var mapManager = server.ResolveDependency();
@@ -149,10 +162,16 @@ public async Task NoSuffocationTest()
await server.WaitPost(() =>
{
mapId = mapManager.CreateMap();
- grid = mapLoader.LoadGrid(mapId, testMapName);
+
+ Assert.That(mapLoader.TryLoad(mapId, testMapName, out var ents), Is.True);
+ var query = entityManager.GetEntityQuery();
+ grid = ents
+ .Select(x => x)
+ .FirstOrDefault((uid) => uid.HasValue && query.HasComponent(uid.Value), null);
+ Assert.That(grid, Is.Not.Null);
});
- Assert.NotNull(grid, $"Test blueprint {testMapName} not found.");
+ Assert.That(grid, Is.Not.Null, $"Test blueprint {testMapName} not found.");
await server.WaitAssertion(() =>
{
@@ -162,11 +181,12 @@ await server.WaitAssertion(() =>
human = entityManager.SpawnEntity("HumanBodyDummy", coordinates);
var mixture = entityManager.System().GetContainingMixture(human);
+#pragma warning disable NUnit2045
Assert.That(mixture.TotalMoles, Is.GreaterThan(0));
-
- Assert.True(entityManager.HasComponent(human));
- Assert.True(entityManager.TryGetComponent(human, out respirator));
- Assert.False(respirator.SuffocationCycles > respirator.SuffocationCycleThreshold);
+ Assert.That(entityManager.HasComponent(human), Is.True);
+ Assert.That(entityManager.TryGetComponent(human, out respirator), Is.True);
+ Assert.That(respirator.SuffocationCycles, Is.LessThanOrEqualTo(respirator.SuffocationCycleThreshold));
+#pragma warning restore NUnit2045
});
var increment = 10;
@@ -179,7 +199,7 @@ await server.WaitAssertion(() =>
await server.WaitRunTicks(increment);
await server.WaitAssertion(() =>
{
- Assert.False(respirator.SuffocationCycles > respirator.SuffocationCycleThreshold,
+ Assert.That(respirator.SuffocationCycles, Is.LessThanOrEqualTo(respirator.SuffocationCycleThreshold),
$"Entity {entityManager.GetComponent(human).EntityName} is suffocating on tick {tick}");
});
}
diff --git a/Content.IntegrationTests/Tests/Body/SaveLoadReparentTest.cs b/Content.IntegrationTests/Tests/Body/SaveLoadReparentTest.cs
index deb2f059c6c..d89048ce539 100644
--- a/Content.IntegrationTests/Tests/Body/SaveLoadReparentTest.cs
+++ b/Content.IntegrationTests/Tests/Body/SaveLoadReparentTest.cs
@@ -1,10 +1,8 @@
-using System.Linq;
-using System.Threading.Tasks;
+using System.Collections.Generic;
+using System.Linq;
using Content.Shared.Body.Components;
using Content.Shared.Body.Systems;
-using NUnit.Framework;
using Robust.Server.GameObjects;
-using Robust.Server.Maps;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
@@ -85,10 +83,22 @@ await server.WaitAssertion(() =>
});
}
- Assert.That(entities
- .EntityQuery()
- .Where(e => entities.GetComponent(e.Owner).EntityPrototype!.Name ==
- "HumanBodyDummy"), Is.Not.Empty);
+ // Converts an entity query enumerator to an enumerable.
+ static IEnumerable<(EntityUid Uid, TComp Comp)> EnumerateQueryEnumerator(EntityQueryEnumerator query)
+ where TComp : Component
+ {
+ while (query.MoveNext(out var uid, out var comp))
+ yield return (uid, comp);
+ }
+
+ Assert.That(
+ EnumerateQueryEnumerator(
+ entities.EntityQueryEnumerator()
+ ).Where((e) =>
+ entities.GetComponent(e.Uid).EntityPrototype!.Name == "HumanBodyDummy"
+ ),
+ Is.Not.Empty
+ );
const string mapPath = $"/{nameof(SaveLoadReparentTest)}{nameof(Test)}map.yml";
@@ -96,22 +106,26 @@ await server.WaitAssertion(() =>
maps.DeleteMap(mapId);
mapId = maps.CreateMap();
- mapLoader.LoadMap(mapId, mapPath);
+ Assert.That(mapLoader.TryLoad(mapId, mapPath, out _), Is.True);
- var query = entities
- .EntityQuery()
- .Where(e => entities.GetComponent(e.Owner).EntityPrototype!.Name == "HumanBodyDummy")
- .ToArray();
+ var query = EnumerateQueryEnumerator(
+ entities.EntityQueryEnumerator()
+ ).Where((e) =>
+ entities.GetComponent(e.Uid).EntityPrototype!.Name == "HumanBodyDummy"
+ ).ToArray();
Assert.That(query, Is.Not.Empty);
- foreach (var body in query)
+ foreach (var (uid, body) in query)
{
- human = body.Owner;
+ human = uid;
parts = bodySystem.GetBodyChildren(human).ToArray();
organs = bodySystem.GetBodyOrgans(human).ToArray();
- Assert.That(parts, Is.Not.Empty);
- Assert.That(organs, Is.Not.Empty);
+ Assert.Multiple(() =>
+ {
+ Assert.That(parts, Is.Not.Empty);
+ Assert.That(organs, Is.Not.Empty);
+ });
foreach (var (id, component) in parts)
{
diff --git a/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs b/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs
index f2f278b4aed..2421e065608 100644
--- a/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs
+++ b/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs
@@ -1,4 +1,3 @@
-using System.Threading.Tasks;
using Content.Server.Body.Systems;
using Content.Shared.Buckle;
using Content.Shared.ActionBlocker;
@@ -8,7 +7,6 @@
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Standing;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
namespace Content.IntegrationTests.Tests.Buckle
@@ -50,15 +48,16 @@ public sealed class BuckleTest
public async Task BuckleUnbuckleCooldownRangeTest()
{
await using var pairTracker =
- await PoolManager.GetServerClient(new PoolSettings {ExtraPrototypes = Prototypes});
+ await PoolManager.GetServerClient(new PoolSettings { ExtraPrototypes = Prototypes });
var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
var coordinates = testMap.GridCoords;
var entityManager = server.ResolveDependency();
- var actionBlocker = entityManager.EntitySysManager.GetEntitySystem();
- var buckleSystem = entityManager.EntitySysManager.GetEntitySystem();
- var standingState = entityManager.EntitySysManager.GetEntitySystem();
+ var actionBlocker = entityManager.System();
+ var buckleSystem = entityManager.System();
+ var standingState = entityManager.System();
+ var xformSystem = entityManager.System();
EntityUid human = default;
EntityUid chair = default;
@@ -71,47 +70,58 @@ await server.WaitAssertion(() =>
chair = entityManager.SpawnEntity(StrapDummyId, coordinates);
// Default state, unbuckled
- Assert.True(entityManager.TryGetComponent(human, out buckle));
- Assert.NotNull(buckle);
- Assert.Null(buckle.BuckledTo);
- Assert.False(buckle.Buckled);
- Assert.True(actionBlocker.CanMove(human));
- Assert.True(actionBlocker.CanChangeDirection(human));
- Assert.True(standingState.Down(human));
- Assert.True(standingState.Stand(human));
+ Assert.That(entityManager.TryGetComponent(human, out buckle));
+ Assert.Multiple(() =>
+ {
+ Assert.That(buckle, Is.Not.Null);
+ Assert.That(buckle.BuckledTo, Is.Null);
+ Assert.That(buckle.Buckled, Is.False);
+ Assert.That(actionBlocker.CanMove(human));
+ Assert.That(actionBlocker.CanChangeDirection(human));
+ Assert.That(standingState.Down(human));
+ Assert.That(standingState.Stand(human));
+ });
// Default state, no buckled entities, strap
- Assert.True(entityManager.TryGetComponent(chair, out strap));
- Assert.NotNull(strap);
- Assert.IsEmpty(strap.BuckledEntities);
- Assert.Zero(strap.OccupiedSize);
+ Assert.That(entityManager.TryGetComponent(chair, out strap));
+ Assert.Multiple(() =>
+ {
+ Assert.That(strap, Is.Not.Null);
+ Assert.That(strap.BuckledEntities, Is.Empty);
+ Assert.That(strap.OccupiedSize, Is.Zero);
+ });
// Side effects of buckling
- Assert.True(buckleSystem.TryBuckle(human, human, chair, buckle));
- Assert.NotNull(buckle.BuckledTo);
- Assert.True(buckle.Buckled);
-
- Assert.False(actionBlocker.CanMove(human));
- Assert.False(actionBlocker.CanChangeDirection(human));
- Assert.False(standingState.Down(human));
- Assert.That(
- (entityManager.GetComponent(human).WorldPosition -
- entityManager.GetComponent(chair).WorldPosition).Length,
- Is.LessThanOrEqualTo(0));
-
- // Side effects of buckling for the strap
- Assert.That(strap.BuckledEntities, Does.Contain(human));
- Assert.That(strap.OccupiedSize, Is.EqualTo(buckle.Size));
- Assert.Positive(strap.OccupiedSize);
-
+ Assert.That(buckleSystem.TryBuckle(human, human, chair, buckle));
+ Assert.Multiple(() =>
+ {
+ Assert.That(buckle.BuckledTo, Is.Not.Null);
+ Assert.That(buckle.Buckled);
+
+ Assert.That(actionBlocker.CanMove(human), Is.False);
+ Assert.That(actionBlocker.CanChangeDirection(human), Is.False);
+ Assert.That(standingState.Down(human), Is.False);
+ Assert.That(
+ (xformSystem.GetWorldPosition(human) - xformSystem.GetWorldPosition(chair)).LengthSquared,
+ Is.LessThanOrEqualTo(0)
+ );
+
+ // Side effects of buckling for the strap
+ Assert.That(strap.BuckledEntities, Does.Contain(human));
+ Assert.That(strap.OccupiedSize, Is.EqualTo(buckle.Size));
+ Assert.Positive(strap.OccupiedSize);
+ });
+
+#pragma warning disable NUnit2045 // Interdependent asserts.
// Trying to buckle while already buckled fails
- Assert.False(buckleSystem.TryBuckle(human, human, chair, buckle));
+ Assert.That(buckleSystem.TryBuckle(human, human, chair, buckle), Is.False);
// Trying to unbuckle too quickly fails
- Assert.False(buckleSystem.TryUnbuckle(human, human, buckleComp: buckle));
- Assert.True(buckle.Buckled);
- Assert.False(buckleSystem.ToggleBuckle(human, human, chair, buckle: buckle));
- Assert.True(buckle.Buckled);
+ Assert.That(buckleSystem.TryUnbuckle(human, human, buckleComp: buckle), Is.False);
+ Assert.That(buckle.Buckled);
+ Assert.That(buckleSystem.ToggleBuckle(human, human, chair, buckle: buckle), Is.False);
+ Assert.That(buckle.Buckled);
+#pragma warning restore NUnit2045
});
// Wait enough ticks for the unbuckling cooldown to run out
@@ -119,32 +129,39 @@ await server.WaitAssertion(() =>
await server.WaitAssertion(() =>
{
+#pragma warning disable NUnit2045 // Interdependent asserts.
+ Assert.That(buckle.Buckled);
// Still buckled
- Assert.True(buckle.Buckled);
+#pragma warning restore NUnit2045
// Unbuckle
- Assert.True(buckleSystem.TryUnbuckle(human, human, buckleComp: buckle));
- Assert.Null(buckle.BuckledTo);
- Assert.False(buckle.Buckled);
- Assert.True(actionBlocker.CanMove(human));
- Assert.True(actionBlocker.CanChangeDirection(human));
- Assert.True(standingState.Down(human));
-
- // Unbuckle, strap
- Assert.IsEmpty(strap.BuckledEntities);
- Assert.Zero(strap.OccupiedSize);
-
+ Assert.That(buckleSystem.TryUnbuckle(human, human, buckleComp: buckle));
+ Assert.Multiple(() =>
+ {
+ Assert.That(buckle.BuckledTo, Is.Null);
+ Assert.That(buckle.Buckled, Is.False);
+ Assert.That(actionBlocker.CanMove(human));
+ Assert.That(actionBlocker.CanChangeDirection(human));
+ Assert.That(standingState.Down(human));
+
+ // Unbuckle, strap
+ Assert.That(strap.BuckledEntities, Is.Empty);
+ Assert.That(strap.OccupiedSize, Is.Zero);
+ });
+
+#pragma warning disable NUnit2045 // Interdependent asserts.
// Re-buckling has no cooldown
- Assert.True(buckleSystem.TryBuckle(human, human, chair, buckleComp: buckle));
- Assert.True(buckle.Buckled);
+ Assert.That(buckleSystem.TryBuckle(human, human, chair, buckleComp: buckle));
+ Assert.That(buckle.Buckled);
// On cooldown
- Assert.False(buckleSystem.TryUnbuckle(human, human, buckleComp: buckle));
- Assert.True(buckle.Buckled);
- Assert.False(buckleSystem.ToggleBuckle(human, human, chair, buckle: buckle));
- Assert.True(buckle.Buckled);
- Assert.False(buckleSystem.ToggleBuckle(human, human, chair, buckle: buckle));
- Assert.True(buckle.Buckled);
+ Assert.That(buckleSystem.TryUnbuckle(human, human, buckleComp: buckle), Is.False);
+ Assert.That(buckle.Buckled);
+ Assert.That(buckleSystem.ToggleBuckle(human, human, chair, buckle: buckle), Is.False);
+ Assert.That(buckle.Buckled);
+ Assert.That(buckleSystem.ToggleBuckle(human, human, chair, buckle: buckle), Is.False);
+ Assert.That(buckle.Buckled);
+#pragma warning restore NUnit2045
});
// Wait enough ticks for the unbuckling cooldown to run out
@@ -152,45 +169,57 @@ await server.WaitAssertion(() =>
await server.WaitAssertion(() =>
{
+#pragma warning disable NUnit2045 // Interdependent asserts.
// Still buckled
- Assert.True(buckle.Buckled);
+ Assert.That(buckle.Buckled);
// Unbuckle
- Assert.True(buckleSystem.TryUnbuckle(human, human, buckleComp: buckle));
- Assert.False(buckle.Buckled);
+ Assert.That(buckleSystem.TryUnbuckle(human, human, buckleComp: buckle));
+ Assert.That(buckle.Buckled, Is.False);
+#pragma warning restore NUnit2045
// Move away from the chair
- entityManager.GetComponent(human).WorldPosition += (1000, 1000);
+ var xformQuery = entityManager.GetEntityQuery();
+ var oldWorldPosition = xformSystem.GetWorldPosition(chair, xformQuery);
+ xformSystem.SetWorldPosition(human, oldWorldPosition + (1000, 1000), xformQuery);
// Out of range
- Assert.False(buckleSystem.TryBuckle(human, human, chair, buckleComp: buckle));
- Assert.False(buckleSystem.TryUnbuckle(human, human, buckleComp: buckle));
- Assert.False(buckleSystem.ToggleBuckle(human, human, chair, buckle: buckle));
+#pragma warning disable NUnit2045 // Interdependent asserts.
+ Assert.That(buckleSystem.TryBuckle(human, human, chair, buckleComp: buckle), Is.False);
+ Assert.That(buckleSystem.TryUnbuckle(human, human, buckleComp: buckle), Is.False);
+ Assert.That(buckleSystem.ToggleBuckle(human, human, chair, buckle: buckle), Is.False);
+#pragma warning restore NUnit2045
// Move near the chair
- entityManager.GetComponent(human).WorldPosition =
- entityManager.GetComponent(chair).WorldPosition + (0.5f, 0);
+ oldWorldPosition = xformSystem.GetWorldPosition(chair, xformQuery);
+ xformSystem.SetWorldPosition(human, oldWorldPosition + (0.5f, 0), xformQuery);
// In range
- Assert.True(buckleSystem.TryBuckle(human, human, chair, buckleComp: buckle));
- Assert.True(buckle.Buckled);
- Assert.False(buckleSystem.TryUnbuckle(human, human, buckleComp: buckle));
- Assert.True(buckle.Buckled);
- Assert.False(buckleSystem.ToggleBuckle(human, human, chair, buckle: buckle));
- Assert.True(buckle.Buckled);
+#pragma warning disable NUnit2045 // Interdependent asserts.
+ Assert.That(buckleSystem.TryBuckle(human, human, chair, buckleComp: buckle));
+ Assert.That(buckle.Buckled);
+ Assert.That(buckleSystem.TryUnbuckle(human, human, buckleComp: buckle), Is.False);
+ Assert.That(buckle.Buckled);
+ Assert.That(buckleSystem.ToggleBuckle(human, human, chair, buckle: buckle), Is.False);
+ Assert.That(buckle.Buckled);
+#pragma warning restore NUnit2045
// Force unbuckle
- Assert.True(buckleSystem.TryUnbuckle(human, human, true, buckleComp: buckle));
- Assert.False(buckle.Buckled);
- Assert.True(actionBlocker.CanMove(human));
- Assert.True(actionBlocker.CanChangeDirection(human));
- Assert.True(standingState.Down(human));
+ Assert.That(buckleSystem.TryUnbuckle(human, human, true, buckleComp: buckle));
+ Assert.Multiple(() =>
+ {
+ Assert.That(buckle.Buckled, Is.False);
+ Assert.That(actionBlocker.CanMove(human));
+ Assert.That(actionBlocker.CanChangeDirection(human));
+ Assert.That(standingState.Down(human));
+ });
// Re-buckle
- Assert.True(buckleSystem.TryBuckle(human, human, chair, buckleComp: buckle));
+ Assert.That(buckleSystem.TryBuckle(human, human, chair, buckleComp: buckle));
// Move away from the chair
- entityManager.GetComponent(human).WorldPosition += (1, 0);
+ oldWorldPosition = xformSystem.GetWorldPosition(chair, xformQuery);
+ xformSystem.SetWorldPosition(human, oldWorldPosition + (1, 0), xformQuery);
});
await server.WaitRunTicks(1);
@@ -198,9 +227,12 @@ await server.WaitAssertion(() =>
await server.WaitAssertion(() =>
{
// No longer buckled
- Assert.False(buckle.Buckled);
- Assert.Null(buckle.BuckledTo);
- Assert.IsEmpty(strap.BuckledEntities);
+ Assert.Multiple(() =>
+ {
+ Assert.That(buckle.Buckled, Is.False);
+ Assert.That(buckle.BuckledTo, Is.Null);
+ Assert.That(strap.BuckledEntities, Is.Empty);
+ });
});
await pairTracker.CleanReturnAsync();
@@ -210,7 +242,10 @@ await server.WaitAssertion(() =>
public async Task BuckledDyingDropItemsTest()
{
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
- {NoClient = true, ExtraPrototypes = Prototypes});
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
@@ -233,22 +268,28 @@ await server.WaitAssertion(() =>
var chair = entityManager.SpawnEntity(StrapDummyId, coordinates);
// Component sanity check
- Assert.True(entityManager.TryGetComponent(human, out buckle));
- Assert.True(entityManager.HasComponent(chair));
- Assert.True(entityManager.TryGetComponent(human, out hands));
- Assert.True(entityManager.TryGetComponent(human, out body));
+ Assert.Multiple(() =>
+ {
+ Assert.That(entityManager.TryGetComponent(human, out buckle));
+ Assert.That(entityManager.HasComponent(chair));
+ Assert.That(entityManager.TryGetComponent(human, out hands));
+ Assert.That(entityManager.TryGetComponent(human, out body));
+ });
// Buckle
- Assert.True(buckleSystem.TryBuckle(human, human, chair, buckleComp: buckle));
- Assert.NotNull(buckle.BuckledTo);
- Assert.True(buckle.Buckled);
+ Assert.That(buckleSystem.TryBuckle(human, human, chair, buckleComp: buckle));
+ Assert.Multiple(() =>
+ {
+ Assert.That(buckle.BuckledTo, Is.Not.Null);
+ Assert.That(buckle.Buckled);
+ });
// Put an item into every hand
for (var i = 0; i < hands.Count; i++)
{
var akms = entityManager.SpawnEntity(ItemDummyId, coordinates);
- Assert.True(handsSys.TryPickupAnyHand(human, akms));
+ Assert.That(handsSys.TryPickupAnyHand(human, akms));
}
});
@@ -257,16 +298,16 @@ await server.WaitAssertion(() =>
await server.WaitAssertion(() =>
{
// Still buckled
- Assert.True(buckle.Buckled);
+ Assert.That(buckle.Buckled);
// With items in all hands
foreach (var hand in hands.Hands.Values)
{
- Assert.NotNull(hand.HeldEntity);
+ Assert.That(hand.HeldEntity, Is.Not.Null);
}
var bodySystem = entityManager.System();
- var legs = bodySystem.GetBodyChildrenOfType(body.Owner, BodyPartType.Leg, body);
+ var legs = bodySystem.GetBodyChildrenOfType(human, BodyPartType.Leg, body);
// Break our guy's kneecaps
foreach (var leg in legs)
@@ -280,12 +321,12 @@ await server.WaitAssertion(() =>
await server.WaitAssertion(() =>
{
// Still buckled
- Assert.True(buckle.Buckled);
+ Assert.That(buckle.Buckled);
// Now with no item in any hand
foreach (var hand in hands.Hands.Values)
{
- Assert.Null(hand.HeldEntity);
+ Assert.That(hand.HeldEntity, Is.Null);
}
buckleSystem.TryUnbuckle(human, human, true, buckleComp: buckle);
@@ -298,13 +339,17 @@ await server.WaitAssertion(() =>
public async Task ForceUnbuckleBuckleTest()
{
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
- {NoClient = true, ExtraPrototypes = Prototypes});
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
var coordinates = testMap.GridCoords;
var entityManager = server.ResolveDependency();
var buckleSystem = entityManager.System();
+ var xformSystem = entityManager.System();
EntityUid human = default;
EntityUid chair = default;
@@ -316,31 +361,44 @@ await server.WaitAssertion(() =>
chair = entityManager.SpawnEntity(StrapDummyId, coordinates);
// Component sanity check
- Assert.True(entityManager.TryGetComponent(human, out buckle));
- Assert.True(entityManager.HasComponent(chair));
+ Assert.Multiple(() =>
+ {
+ Assert.That(entityManager.TryGetComponent(human, out buckle));
+ Assert.That(entityManager.HasComponent(chair));
+ });
// Buckle
- Assert.True(buckleSystem.TryBuckle(human, human, chair, buckleComp: buckle));
- Assert.NotNull(buckle.BuckledTo);
- Assert.True(buckle.Buckled);
+ Assert.That(buckleSystem.TryBuckle(human, human, chair, buckleComp: buckle));
+ Assert.Multiple(() =>
+ {
+ Assert.That(buckle.BuckledTo, Is.Not.Null);
+ Assert.That(buckle.Buckled);
+ });
// Move the buckled entity away
- entityManager.GetComponent(human).WorldPosition += (100, 0);
+ var xformQuery = entityManager.GetEntityQuery();
+ var oldWorldPosition = xformSystem.GetWorldPosition(chair, xformQuery);
+ xformSystem.SetWorldPosition(human, oldWorldPosition + (100, 0), xformQuery);
});
await PoolManager.WaitUntil(server, () => !buckle.Buckled, 10);
- Assert.False(buckle.Buckled);
+ Assert.That(buckle.Buckled, Is.False);
await server.WaitAssertion(() =>
{
// Move the now unbuckled entity back onto the chair
- entityManager.GetComponent(human).WorldPosition -= (100, 0);
+ var xformQuery = entityManager.GetEntityQuery();
+ var oldWorldPosition = xformSystem.GetWorldPosition(chair, xformQuery);
+ xformSystem.SetWorldPosition(human, oldWorldPosition, xformQuery);
// Buckle
- Assert.True(buckleSystem.TryBuckle(human, human, chair, buckleComp: buckle));
- Assert.NotNull(buckle.BuckledTo);
- Assert.True(buckle.Buckled);
+ Assert.That(buckleSystem.TryBuckle(human, human, chair, buckleComp: buckle));
+ Assert.Multiple(() =>
+ {
+ Assert.That(buckle.BuckledTo, Is.Not.Null);
+ Assert.That(buckle.Buckled);
+ });
});
await server.WaitRunTicks(60);
@@ -348,8 +406,11 @@ await server.WaitAssertion(() =>
await server.WaitAssertion(() =>
{
// Still buckled
- Assert.NotNull(buckle.BuckledTo);
- Assert.True(buckle.Buckled);
+ Assert.Multiple(() =>
+ {
+ Assert.That(buckle.BuckledTo, Is.Not.Null);
+ Assert.That(buckle.Buckled);
+ });
});
await pairTracker.CleanReturnAsync();
}
diff --git a/Content.IntegrationTests/Tests/CargoTest.cs b/Content.IntegrationTests/Tests/CargoTest.cs
index 61a451af8a3..86810453ca3 100644
--- a/Content.IntegrationTests/Tests/CargoTest.cs
+++ b/Content.IntegrationTests/Tests/CargoTest.cs
@@ -1,12 +1,8 @@
-using System.Threading.Tasks;
using System.Linq;
using Content.Server.Cargo.Components;
using Content.Server.Cargo.Systems;
using Content.Shared.Cargo.Prototypes;
-using Content.Shared.CCVar;
using Content.Shared.Stacks;
-using NUnit.Framework;
-using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;
@@ -20,7 +16,7 @@ public sealed class CargoTest
[Test]
public async Task NoCargoOrderArbitrage()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings() {NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings() { NoClient = true });
var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
@@ -54,7 +50,7 @@ await server.WaitAssertion(() =>
[Test]
public async Task NoCargoBountyArbitageTest()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings() {NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings() { NoClient = true });
var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
@@ -95,7 +91,7 @@ await server.WaitAssertion(() =>
[Test]
public async Task NoStaticPriceAndStackPrice()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
@@ -111,7 +107,7 @@ await server.WaitAssertion(() =>
var coord = new EntityCoordinates(grid.Owner, 0, 0);
var protoIds = protoManager.EnumeratePrototypes()
- .Where(p=>!p.Abstract)
+ .Where(p => !p.Abstract)
.Where(p => !p.Components.ContainsKey("MapGrid")) // Grids are not for sale.
.Select(p => p.ID)
.ToList();
@@ -150,7 +146,7 @@ await server.WaitAssertion(() =>
[Test]
public async Task StackPrice()
{
- const string StackProto = @"
+ const string stackProto = @"
- type: entity
id: A
@@ -168,7 +164,7 @@ public async Task StackPrice()
count: 5
";
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = StackProto});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true, ExtraPrototypes = stackProto });
var server = pairTracker.Pair.Server;
var entManager = server.ResolveDependency();
diff --git a/Content.IntegrationTests/Tests/Chemistry/DispenserTest.cs b/Content.IntegrationTests/Tests/Chemistry/DispenserTest.cs
index eebb3358dfe..affb43db3ec 100644
--- a/Content.IntegrationTests/Tests/Chemistry/DispenserTest.cs
+++ b/Content.IntegrationTests/Tests/Chemistry/DispenserTest.cs
@@ -1,9 +1,7 @@
-using System.Threading.Tasks;
using Content.Client.Chemistry.UI;
using Content.IntegrationTests.Tests.Interaction;
using Content.Shared.Chemistry;
using Content.Shared.Containers.ItemSlots;
-using NUnit.Framework;
namespace Content.IntegrationTests.Tests.Chemistry;
@@ -20,7 +18,7 @@ public async Task InsertEjectBuiTest()
// Insert beaker
await Interact("Beaker");
- Assert.IsNull(Hands.ActiveHandEntity);
+ Assert.That(Hands.ActiveHandEntity, Is.Null);
// Open BUI
await Interact();
@@ -30,18 +28,18 @@ public async Task InsertEjectBuiTest()
await SendBui(ReagentDispenserUiKey.Key, ev);
// Beaker is back in the player's hands
- Assert.IsNotNull(Hands.ActiveHandEntity);
+ Assert.That(Hands.ActiveHandEntity, Is.Not.Null);
AssertPrototype("Beaker", Hands.ActiveHandEntity);
// Re-insert the beaker
await Interact();
- Assert.IsNull(Hands.ActiveHandEntity);
+ Assert.That(Hands.ActiveHandEntity, Is.Null);
// Re-eject using the button directly instead of sending a BUI event. This test is really just a test of the
// bui/window helper methods.
await ClickControl(nameof(ReagentDispenserWindow.EjectButton));
await RunTicks(5);
- Assert.IsNotNull(Hands.ActiveHandEntity);
+ Assert.That(Hands.ActiveHandEntity, Is.Not.Null);
AssertPrototype("Beaker", Hands.ActiveHandEntity);
}
}
diff --git a/Content.IntegrationTests/Tests/Chemistry/FixedPoint2SerializationTest.cs b/Content.IntegrationTests/Tests/Chemistry/FixedPoint2SerializationTest.cs
index beff69eddf0..66918e3a496 100644
--- a/Content.IntegrationTests/Tests/Chemistry/FixedPoint2SerializationTest.cs
+++ b/Content.IntegrationTests/Tests/Chemistry/FixedPoint2SerializationTest.cs
@@ -1,6 +1,5 @@
using System.Reflection;
using Content.Shared.FixedPoint;
-using NUnit.Framework;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.Markdown.Mapping;
using Robust.Shared.Serialization.Markdown.Value;
@@ -35,8 +34,10 @@ public void SerializeNullTest()
public void SerializeNullableValueTest()
{
var node = Serialization.WriteValue(FixedPoint2.New(2.5f));
+#pragma warning disable NUnit2045 // Interdependent assertions
Assert.That(node is ValueDataNode);
- Assert.That(((ValueDataNode)node).Value, Is.EqualTo("2.5"));
+ Assert.That(((ValueDataNode) node).Value, Is.EqualTo("2.5"));
+#pragma warning restore NUnit2045
}
[Test]
diff --git a/Content.IntegrationTests/Tests/Chemistry/SolutionSystemTests.cs b/Content.IntegrationTests/Tests/Chemistry/SolutionSystemTests.cs
index 661868e6387..0372e5ca882 100644
--- a/Content.IntegrationTests/Tests/Chemistry/SolutionSystemTests.cs
+++ b/Content.IntegrationTests/Tests/Chemistry/SolutionSystemTests.cs
@@ -1,8 +1,6 @@
-using System.Threading.Tasks;
using Content.Server.Chemistry.EntitySystems;
using Content.Shared.Chemistry.Components;
using Content.Shared.FixedPoint;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;
@@ -47,7 +45,11 @@ public sealed class SolutionSystemTests
[Test]
public async Task TryAddTwoNonReactiveReagent()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var entityManager = server.ResolveDependency();
@@ -76,8 +78,11 @@ await server.WaitAssertion(() =>
solution.TryGetReagent("Water", out var water);
solution.TryGetReagent("Oil", out var oil);
- Assert.That(water, Is.EqualTo(waterQuantity));
- Assert.That(oil, Is.EqualTo(oilQuantity));
+ Assert.Multiple(() =>
+ {
+ Assert.That(water, Is.EqualTo(waterQuantity));
+ Assert.That(oil, Is.EqualTo(oilQuantity));
+ });
});
await pairTracker.CleanReturnAsync();
@@ -88,7 +93,11 @@ await server.WaitAssertion(() =>
[Test]
public async Task TryAddTooMuchNonReactiveReagent()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
@@ -118,8 +127,11 @@ await server.WaitAssertion(() =>
solution.TryGetReagent("Water", out var water);
solution.TryGetReagent("Oil", out var oil);
- Assert.That(water, Is.EqualTo(waterQuantity));
- Assert.That(oil, Is.EqualTo(FixedPoint2.Zero));
+ Assert.Multiple(() =>
+ {
+ Assert.That(water, Is.EqualTo(waterQuantity));
+ Assert.That(oil, Is.EqualTo(FixedPoint2.Zero));
+ });
});
await pairTracker.CleanReturnAsync();
@@ -129,7 +141,11 @@ await server.WaitAssertion(() =>
[Test]
public async Task TryMixAndOverflowTooMuchReagent()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
@@ -141,10 +157,10 @@ public async Task TryMixAndOverflowTooMuchReagent()
EntityUid beaker;
- await server.WaitAssertion((System.Action)(() =>
+ await server.WaitAssertion(() =>
{
- int ratio = 9;
- int threshold = 20;
+ var ratio = 9;
+ var threshold = 20;
var waterQuantity = FixedPoint2.New(10);
var oilQuantity = FixedPoint2.New(ratio * waterQuantity.Int());
@@ -159,18 +175,23 @@ await server.WaitAssertion((System.Action)(() =>
Assert.That(containerSystem
.TryMixAndOverflow(beaker, solution, oilAdded, threshold, out var overflowingSolution));
- Assert.That(solution.Volume, Is.EqualTo(FixedPoint2.New(threshold)));
- solution.TryGetReagent("Water", out var waterMix);
- solution.TryGetReagent("Oil", out var oilMix);
- Assert.That(waterMix, Is.EqualTo(FixedPoint2.New(threshold / (ratio + 1))));
- Assert.That(oilMix, Is.EqualTo(FixedPoint2.New(threshold / (ratio + 1) * ratio)));
+ Assert.Multiple(() =>
+ {
+ Assert.That(solution.Volume, Is.EqualTo(FixedPoint2.New(threshold)));
+
+ solution.TryGetReagent("Water", out var waterMix);
+ solution.TryGetReagent("Oil", out var oilMix);
+ Assert.That(waterMix, Is.EqualTo(FixedPoint2.New(threshold / (ratio + 1))));
+ Assert.That(oilMix, Is.EqualTo(FixedPoint2.New(threshold / (ratio + 1) * ratio)));
+
+ Assert.That(overflowingSolution.Volume, Is.EqualTo(FixedPoint2.New(80)));
- Assert.That(overflowingSolution.Volume, Is.EqualTo(FixedPoint2.New(80)));
- overflowingSolution.TryGetReagent("Water", out var waterOverflow);
- overflowingSolution.TryGetReagent("Oil", out var oilOverFlow);
- Assert.That(waterOverflow, Is.EqualTo(waterQuantity - waterMix));
- Assert.That(oilOverFlow, Is.EqualTo(oilQuantity - oilMix));
- }));
+ overflowingSolution.TryGetReagent("Water", out var waterOverflow);
+ overflowingSolution.TryGetReagent("Oil", out var oilOverFlow);
+ Assert.That(waterOverflow, Is.EqualTo(waterQuantity - waterMix));
+ Assert.That(oilOverFlow, Is.EqualTo(oilQuantity - oilMix));
+ });
+ });
await pairTracker.CleanReturnAsync();
}
@@ -179,7 +200,11 @@ await server.WaitAssertion((System.Action)(() =>
[Test]
public async Task TryMixAndOverflowTooBigOverflow()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var entityManager = server.ResolveDependency();
@@ -192,8 +217,8 @@ public async Task TryMixAndOverflowTooBigOverflow()
await server.WaitAssertion(() =>
{
- int ratio = 9;
- int threshold = 60;
+ var ratio = 9;
+ var threshold = 60;
var waterQuantity = FixedPoint2.New(10);
var oilQuantity = FixedPoint2.New(ratio * waterQuantity.Int());
diff --git a/Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs b/Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs
index 282b2a169d9..37a9c7c1625 100644
--- a/Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs
+++ b/Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs
@@ -1,11 +1,7 @@
-using System;
using System.Linq;
-using System.Threading.Tasks;
using Content.Server.Chemistry.EntitySystems;
-using Content.Server.Engineering.Components;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reaction;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
@@ -29,7 +25,11 @@ public sealed class TryAllReactionsTest
[Test]
public async Task TryAllTest()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var entityManager = server.ResolveDependency();
@@ -54,9 +54,11 @@ await server.WaitAssertion(() =>
.TryGetSolution(beaker, "beaker", out component));
foreach (var (id, reactant) in reactionPrototype.Reactants)
{
+#pragma warning disable NUnit2045
Assert.That(solutionSystem
.TryAddReagent(beaker, component, id, reactant.Amount, out var quantity));
Assert.That(reactant.Amount, Is.EqualTo(quantity));
+#pragma warning restore NUnit2045
}
solutionSystem.SetTemperature(beaker, component, reactionPrototype.MinimumTemperature);
diff --git a/Content.IntegrationTests/Tests/Cleanup/EuiManagerTest.cs b/Content.IntegrationTests/Tests/Cleanup/EuiManagerTest.cs
index 78619f98f44..d8efb03f7da 100644
--- a/Content.IntegrationTests/Tests/Cleanup/EuiManagerTest.cs
+++ b/Content.IntegrationTests/Tests/Cleanup/EuiManagerTest.cs
@@ -1,10 +1,7 @@
using System.Linq;
-using System.Threading.Tasks;
using Content.Server.Administration.UI;
using Content.Server.EUI;
-using NUnit.Framework;
using Robust.Server.Player;
-using Robust.Shared.IoC;
namespace Content.IntegrationTests.Tests.Cleanup;
@@ -14,9 +11,9 @@ public sealed class EuiManagerTest
public async Task EuiManagerRecycleWithOpenWindowTest()
{
// Even though we are using the server EUI here, we actually want to see if the client EUIManager crashes
- for (int i = 0; i < 2; i++)
+ for (var i = 0; i < 2; i++)
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{Dirty = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { Dirty = true });
var server = pairTracker.Pair.Server;
var sPlayerManager = server.ResolveDependency();
diff --git a/Content.IntegrationTests/Tests/ClickableTest.cs b/Content.IntegrationTests/Tests/ClickableTest.cs
index dcaf06829e3..2a88a181d9c 100644
--- a/Content.IntegrationTests/Tests/ClickableTest.cs
+++ b/Content.IntegrationTests/Tests/ClickableTest.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Threading.Tasks;
using Content.Client.Clickable;
-using NUnit.Framework;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.GameObjects;
@@ -61,7 +58,7 @@ public async Task Test(string prototype, float clickPosX, float clickPosY,
await server.WaitPost(() =>
{
var ent = serverEntManager.SpawnEntity(prototype, testMap.GridCoords);
- serverEntManager.GetComponent(ent).WorldRotation = angle;
+ serverEntManager.System().SetWorldRotation(ent, angle);
entity = ent;
});
@@ -78,7 +75,7 @@ await client.WaitPost(() =>
// these tests currently all assume player eye is 0
eyeManager.CurrentEye.Rotation = 0;
- var pos = clientEntManager.GetComponent(entity).WorldPosition;
+ var pos = clientEntManager.System().GetWorldPosition(entity);
var clickable = clientEntManager.GetComponent(entity);
hit = clickable.CheckClick(sprite, xformQuery.GetComponent(entity), xformQuery, (clickPosX, clickPosY) + pos, eye, out _, out _, out _);
diff --git a/Content.IntegrationTests/Tests/Climbing/ClimbingTest.cs b/Content.IntegrationTests/Tests/Climbing/ClimbingTest.cs
index 0eb2635025a..3212e51e3ec 100644
--- a/Content.IntegrationTests/Tests/Climbing/ClimbingTest.cs
+++ b/Content.IntegrationTests/Tests/Climbing/ClimbingTest.cs
@@ -1,11 +1,8 @@
#nullable enable
-using System.Threading.Tasks;
using Content.IntegrationTests.Tests.Interaction;
using Content.Server.Climbing;
using Content.Shared.Climbing;
-using NUnit.Framework;
using Robust.Shared.Maths;
-using Robust.Shared.Physics.Components;
namespace Content.IntegrationTests.Tests.Climbing;
@@ -20,8 +17,11 @@ public async Task ClimbTableTest()
// Player is not initially climbing anything.
var comp = Comp(Player);
- Assert.That(comp.IsClimbing, Is.False);
- Assert.That(comp.DisabledFixtureMasks.Count, Is.EqualTo(0));
+ Assert.Multiple(() =>
+ {
+ Assert.That(comp.IsClimbing, Is.False);
+ Assert.That(comp.DisabledFixtureMasks, Has.Count.EqualTo(0));
+ });
// Attempt (and fail) to walk past the table.
await Move(DirectionFlag.East, 1f);
@@ -33,16 +33,23 @@ public async Task ClimbTableTest()
await AwaitDoAfters();
// Player should now be climbing
- Assert.That(comp.IsClimbing, Is.True);
- Assert.That(comp.DisabledFixtureMasks.Count, Is.GreaterThan(0));
+ Assert.Multiple(() =>
+ {
+ Assert.That(comp.IsClimbing, Is.True);
+ Assert.That(comp.DisabledFixtureMasks, Has.Count.GreaterThan(0));
+ });
// Can now walk over the table.
await Move(DirectionFlag.East, 1f);
- Assert.That(Delta(), Is.LessThan(0));
- // After walking away from the table, player should have stopped climbing.
- Assert.That(comp.IsClimbing, Is.False);
- Assert.That(comp.DisabledFixtureMasks.Count, Is.EqualTo(0));
+ Assert.Multiple(() =>
+ {
+ Assert.That(Delta(), Is.LessThan(0));
+
+ // After walking away from the table, player should have stopped climbing.
+ Assert.That(comp.IsClimbing, Is.False);
+ Assert.That(comp.DisabledFixtureMasks, Has.Count.EqualTo(0));
+ });
// Try to walk back to the other side (and fail).
await Move(DirectionFlag.West, 1f);
@@ -51,14 +58,20 @@ public async Task ClimbTableTest()
// Start climbing
await Server.WaitPost(() => sys.TryClimb(Player, Player, Target.Value));
await AwaitDoAfters();
- Assert.That(comp.IsClimbing, Is.True);
- Assert.That(comp.DisabledFixtureMasks.Count, Is.GreaterThan(0));
+
+ Assert.Multiple(() =>
+ {
+ Assert.That(comp.IsClimbing, Is.True);
+ Assert.That(comp.DisabledFixtureMasks, Has.Count.GreaterThan(0));
+ });
// Walk past table and stop climbing again.
await Move(DirectionFlag.West, 1f);
- Assert.That(Delta(), Is.GreaterThan(0));
- Assert.That(comp.IsClimbing, Is.False);
- Assert.That(comp.DisabledFixtureMasks.Count, Is.EqualTo(0));
+ Assert.Multiple(() =>
+ {
+ Assert.That(Delta(), Is.GreaterThan(0));
+ Assert.That(comp.IsClimbing, Is.False);
+ Assert.That(comp.DisabledFixtureMasks, Has.Count.EqualTo(0));
+ });
}
}
-
diff --git a/Content.IntegrationTests/Tests/Commands/PardonCommand.cs b/Content.IntegrationTests/Tests/Commands/PardonCommand.cs
index d7de02371da..d889840917f 100644
--- a/Content.IntegrationTests/Tests/Commands/PardonCommand.cs
+++ b/Content.IntegrationTests/Tests/Commands/PardonCommand.cs
@@ -1,8 +1,5 @@
-using System;
using System.Linq;
-using System.Threading.Tasks;
using Content.Server.Database;
-using NUnit.Framework;
using Robust.Server.Console;
using Robust.Server.Player;
@@ -17,7 +14,7 @@ public sealed class PardonCommand
[Test]
public async Task PardonTest()
{
- await using var pairTracker = await PoolManager.GetServerClient(new (){Destructive = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new() { Destructive = true });
var server = pairTracker.Pair.Server;
var sPlayerManager = server.ResolveDependency();
@@ -30,17 +27,23 @@ await server.WaitAssertion(async () =>
var clientId = clientSession.UserId;
// No bans on record
- Assert.That(await sDatabase.GetServerBanAsync(null, clientId, null), Is.Null);
- Assert.That(await sDatabase.GetServerBanAsync(1), Is.Null);
- Assert.That(await sDatabase.GetServerBansAsync(null, clientId, null), Is.Empty);
+ Assert.Multiple(async () =>
+ {
+ Assert.That(await sDatabase.GetServerBanAsync(null, clientId, null), Is.Null);
+ Assert.That(await sDatabase.GetServerBanAsync(1), Is.Null);
+ Assert.That(await sDatabase.GetServerBansAsync(null, clientId, null), Is.Empty);
+ });
// Try to pardon a ban that does not exist
sConsole.ExecuteCommand("pardon 1");
// Still no bans on record
- Assert.That(await sDatabase.GetServerBanAsync(null, clientId, null), Is.Null);
- Assert.That(await sDatabase.GetServerBanAsync(1), Is.Null);
- Assert.That(await sDatabase.GetServerBansAsync(null, clientId, null), Is.Empty);
+ Assert.Multiple(async () =>
+ {
+ Assert.That(await sDatabase.GetServerBanAsync(null, clientId, null), Is.Null);
+ Assert.That(await sDatabase.GetServerBanAsync(1), Is.Null);
+ Assert.That(await sDatabase.GetServerBansAsync(null, clientId, null), Is.Empty);
+ });
var banReason = "test";
@@ -48,9 +51,12 @@ await server.WaitAssertion(async () =>
sConsole.ExecuteCommand($"ban {clientSession.Name} {banReason} 1440");
// Should have one ban on record now
- Assert.That(await sDatabase.GetServerBanAsync(null, clientId, null), Is.Not.Null);
- Assert.That(await sDatabase.GetServerBanAsync(1), Is.Not.Null);
- Assert.That(await sDatabase.GetServerBansAsync(null, clientId, null), Has.Count.EqualTo(1));
+ Assert.Multiple(async () =>
+ {
+ Assert.That(await sDatabase.GetServerBanAsync(null, clientId, null), Is.Not.Null);
+ Assert.That(await sDatabase.GetServerBanAsync(1), Is.Not.Null);
+ Assert.That(await sDatabase.GetServerBansAsync(null, clientId, null), Has.Count.EqualTo(1));
+ });
// Try to pardon a ban that does not exist
sConsole.ExecuteCommand("pardon 2");
@@ -59,22 +65,23 @@ await server.WaitAssertion(async () =>
Assert.That(await sDatabase.GetServerBanAsync(null, clientId, null), Is.Not.Null);
var ban = await sDatabase.GetServerBanAsync(1);
- Assert.That(ban, Is.Not.Null);
-
- Assert.That(await sDatabase.GetServerBansAsync(null, clientId, null), Has.Count.EqualTo(1));
-
- // Check that it matches
- Assert.That(ban.Id, Is.EqualTo(1));
- Assert.That(ban.UserId, Is.EqualTo(clientId));
- Assert.That(ban.BanTime.UtcDateTime - DateTime.UtcNow, Is.LessThanOrEqualTo(MarginOfError));
- Assert.NotNull(ban.ExpirationTime);
- Assert.That(ban.ExpirationTime.Value.UtcDateTime - DateTime.UtcNow.AddHours(24), Is.LessThanOrEqualTo(MarginOfError));
- Assert.That(ban.Reason, Is.EqualTo(banReason));
-
- // Done through the console
- Assert.That(ban.BanningAdmin, Is.Null);
-
- Assert.That(ban.Unban, Is.Null);
+ Assert.Multiple(async () =>
+ {
+ Assert.That(ban, Is.Not.Null);
+ Assert.That(await sDatabase.GetServerBansAsync(null, clientId, null), Has.Count.EqualTo(1));
+
+ // Check that it matches
+ Assert.That(ban.Id, Is.EqualTo(1));
+ Assert.That(ban.UserId, Is.EqualTo(clientId));
+ Assert.That(ban.BanTime.UtcDateTime - DateTime.UtcNow, Is.LessThanOrEqualTo(MarginOfError));
+ Assert.That(ban.ExpirationTime, Is.Not.Null);
+ Assert.That(ban.ExpirationTime.Value.UtcDateTime - DateTime.UtcNow.AddHours(24), Is.LessThanOrEqualTo(MarginOfError));
+ Assert.That(ban.Reason, Is.EqualTo(banReason));
+
+ // Done through the console
+ Assert.That(ban.BanningAdmin, Is.Null);
+ Assert.That(ban.Unban, Is.Null);
+ });
// Pardon the actual ban
sConsole.ExecuteCommand("pardon 1");
@@ -84,42 +91,48 @@ await server.WaitAssertion(async () =>
// Direct id lookup returns a pardoned ban
var pardonedBan = await sDatabase.GetServerBanAsync(1);
- Assert.That(pardonedBan, Is.Not.Null);
+ Assert.Multiple(async () =>
+ {
+ // Check that it matches
+ Assert.That(pardonedBan, Is.Not.Null);
- // The list is still returned since that ignores pardons
- Assert.That(await sDatabase.GetServerBansAsync(null, clientId, null), Has.Count.EqualTo(1));
+ // The list is still returned since that ignores pardons
+ Assert.That(await sDatabase.GetServerBansAsync(null, clientId, null), Has.Count.EqualTo(1));
- // Check that it matches
- Assert.That(pardonedBan.Id, Is.EqualTo(1));
- Assert.That(pardonedBan.UserId, Is.EqualTo(clientId));
- Assert.That(pardonedBan.BanTime.UtcDateTime - DateTime.UtcNow, Is.LessThanOrEqualTo(MarginOfError));
- Assert.NotNull(pardonedBan.ExpirationTime);
- Assert.That(pardonedBan.ExpirationTime.Value.UtcDateTime - DateTime.UtcNow.AddHours(24), Is.LessThanOrEqualTo(MarginOfError));
- Assert.That(pardonedBan.Reason, Is.EqualTo(banReason));
+ Assert.That(pardonedBan.Id, Is.EqualTo(1));
+ Assert.That(pardonedBan.UserId, Is.EqualTo(clientId));
+ Assert.That(pardonedBan.BanTime.UtcDateTime - DateTime.UtcNow, Is.LessThanOrEqualTo(MarginOfError));
+ Assert.That(pardonedBan.ExpirationTime, Is.Not.Null);
+ Assert.That(pardonedBan.ExpirationTime.Value.UtcDateTime - DateTime.UtcNow.AddHours(24), Is.LessThanOrEqualTo(MarginOfError));
+ Assert.That(pardonedBan.Reason, Is.EqualTo(banReason));
- // Done through the console
- Assert.That(pardonedBan.BanningAdmin, Is.Null);
+ // Done through the console
+ Assert.That(pardonedBan.BanningAdmin, Is.Null);
- Assert.That(pardonedBan.Unban, Is.Not.Null);
- Assert.That(pardonedBan.Unban.BanId, Is.EqualTo(1));
+ Assert.That(pardonedBan.Unban, Is.Not.Null);
+ Assert.That(pardonedBan.Unban.BanId, Is.EqualTo(1));
- // Done through the console
- Assert.That(pardonedBan.Unban.UnbanningAdmin, Is.Null);
+ // Done through the console
+ Assert.That(pardonedBan.Unban.UnbanningAdmin, Is.Null);
- Assert.That(pardonedBan.Unban.UnbanTime.UtcDateTime - DateTime.UtcNow, Is.LessThanOrEqualTo(MarginOfError));
+ Assert.That(pardonedBan.Unban.UnbanTime.UtcDateTime - DateTime.UtcNow, Is.LessThanOrEqualTo(MarginOfError));
+ });
// Try to pardon it again
sConsole.ExecuteCommand("pardon 1");
// Nothing changes
- // No bans should be returned
- Assert.That(await sDatabase.GetServerBanAsync(null, clientId, null), Is.Null);
+ Assert.Multiple(async () =>
+ {
+ // No bans should be returned
+ Assert.That(await sDatabase.GetServerBanAsync(null, clientId, null), Is.Null);
- // Direct id lookup returns a pardoned ban
- Assert.That(await sDatabase.GetServerBanAsync(1), Is.Not.Null);
+ // Direct id lookup returns a pardoned ban
+ Assert.That(await sDatabase.GetServerBanAsync(1), Is.Not.Null);
- // The list is still returned since that ignores pardons
- Assert.That(await sDatabase.GetServerBansAsync(null, clientId, null), Has.Count.EqualTo(1));
+ // The list is still returned since that ignores pardons
+ Assert.That(await sDatabase.GetServerBansAsync(null, clientId, null), Has.Count.EqualTo(1));
+ });
});
await pairTracker.CleanReturnAsync();
}
diff --git a/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs b/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs
index 1c72004920a..782189c5458 100644
--- a/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs
+++ b/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs
@@ -1,11 +1,9 @@
-using System.Threading.Tasks;
-using Content.Server.Administration.Commands;
+using Content.Server.Administration.Commands;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.FixedPoint;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
@@ -34,7 +32,11 @@ public sealed class RejuvenateTest
[Test]
public async Task RejuvenateDeadTest()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var entManager = server.ResolveDependency();
var mapManager = server.ResolveDependency();
@@ -45,37 +47,50 @@ public async Task RejuvenateDeadTest()
await server.WaitAssertion(() =>
{
var human = entManager.SpawnEntity("DamageableDummy", MapCoordinates.Nullspace);
+ DamageableComponent damageable = null;
+ MobStateComponent mobState = null;
// Sanity check
- Assert.True(entManager.TryGetComponent(human, out DamageableComponent damageable));
- Assert.True(entManager.TryGetComponent(human, out MobStateComponent mobState));
- Assert.That(mobStateSystem.IsAlive(human, mobState), Is.True);
- Assert.That(mobStateSystem.IsCritical(human, mobState), Is.False);
- Assert.That(mobStateSystem.IsDead(human, mobState), Is.False);
- Assert.That(mobStateSystem.IsIncapacitated(human, mobState), Is.False);
+ Assert.Multiple(() =>
+ {
+ Assert.That(entManager.TryGetComponent(human, out damageable));
+ Assert.That(entManager.TryGetComponent(human, out mobState));
+ });
+ Assert.Multiple(() =>
+ {
+ Assert.That(mobStateSystem.IsAlive(human, mobState), Is.True);
+ Assert.That(mobStateSystem.IsCritical(human, mobState), Is.False);
+ Assert.That(mobStateSystem.IsDead(human, mobState), Is.False);
+ Assert.That(mobStateSystem.IsIncapacitated(human, mobState), Is.False);
+ });
// Kill the entity
- DamageSpecifier damage = new(prototypeManager.Index("Toxin"),
- FixedPoint2.New(10000000));
+ DamageSpecifier damage = new(prototypeManager.Index("Toxin"), FixedPoint2.New(10000000));
damSystem.TryChangeDamage(human, damage, true);
// Check that it is dead
- Assert.That(mobStateSystem.IsAlive(human, mobState), Is.False);
- Assert.That(mobStateSystem.IsCritical(human, mobState), Is.False);
- Assert.That(mobStateSystem.IsDead(human, mobState), Is.True);
- Assert.That(mobStateSystem.IsIncapacitated(human, mobState), Is.True);
+ Assert.Multiple(() =>
+ {
+ Assert.That(mobStateSystem.IsAlive(human, mobState), Is.False);
+ Assert.That(mobStateSystem.IsCritical(human, mobState), Is.False);
+ Assert.That(mobStateSystem.IsDead(human, mobState), Is.True);
+ Assert.That(mobStateSystem.IsIncapacitated(human, mobState), Is.True);
+ });
// Rejuvenate them
RejuvenateCommand.PerformRejuvenate(human);
// Check that it is alive and with no damage
- Assert.That(mobStateSystem.IsAlive(human, mobState), Is.True);
- Assert.That(mobStateSystem.IsCritical(human, mobState), Is.False);
- Assert.That(mobStateSystem.IsDead(human, mobState), Is.False);
- Assert.That(mobStateSystem.IsIncapacitated(human, mobState), Is.False);
+ Assert.Multiple(() =>
+ {
+ Assert.That(mobStateSystem.IsAlive(human, mobState), Is.True);
+ Assert.That(mobStateSystem.IsCritical(human, mobState), Is.False);
+ Assert.That(mobStateSystem.IsDead(human, mobState), Is.False);
+ Assert.That(mobStateSystem.IsIncapacitated(human, mobState), Is.False);
- Assert.That(damageable.TotalDamage, Is.EqualTo(FixedPoint2.Zero));
+ Assert.That(damageable.TotalDamage, Is.EqualTo(FixedPoint2.Zero));
+ });
});
await pairTracker.CleanReturnAsync();
}
diff --git a/Content.IntegrationTests/Tests/Commands/RestartRoundTest.cs b/Content.IntegrationTests/Tests/Commands/RestartRoundTest.cs
index 33e83714fbf..2efe022c5e8 100644
--- a/Content.IntegrationTests/Tests/Commands/RestartRoundTest.cs
+++ b/Content.IntegrationTests/Tests/Commands/RestartRoundTest.cs
@@ -1,9 +1,6 @@
-using System;
-using System.Threading.Tasks;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Commands;
using Content.Shared.CCVar;
-using NUnit.Framework;
using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
using Robust.Shared.Timing;
@@ -19,7 +16,7 @@ public sealed class RestartRoundNowTest
[TestCase(false)]
public async Task RestartRoundAfterStart(bool lobbyEnabled)
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings(){Dirty = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings() { Dirty = true });
var server = pairTracker.Pair.Server;
var configManager = server.ResolveDependency();
@@ -54,7 +51,7 @@ await server.WaitAssertion(() =>
{
var tickAfterRestart = entityManager.CurrentTick;
- Assert.That(tickBeforeRestart < tickAfterRestart);
+ Assert.That(tickBeforeRestart, Is.LessThan(tickAfterRestart));
});
await PoolManager.RunTicksSync(pairTracker.Pair, 5);
diff --git a/Content.IntegrationTests/Tests/Construction/ConstructionActionValid.cs b/Content.IntegrationTests/Tests/Construction/ConstructionActionValid.cs
index 774b01fd807..e6e7ea0d339 100644
--- a/Content.IntegrationTests/Tests/Construction/ConstructionActionValid.cs
+++ b/Content.IntegrationTests/Tests/Construction/ConstructionActionValid.cs
@@ -1,9 +1,7 @@
using System.Text;
-using System.Threading.Tasks;
using Content.Server.Construction.Completions;
using Content.Shared.Construction;
using Content.Shared.Construction.Prototypes;
-using NUnit.Framework;
using Robust.Shared.Prototypes;
namespace Content.IntegrationTests.Tests.Construction
@@ -49,7 +47,7 @@ private bool IsValid(IGraphAction action, IPrototypeManager protoMan, out string
[Test]
public async Task ConstructionGraphSpawnPrototypeValid()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
var protoMan = server.ResolveDependency();
@@ -89,7 +87,7 @@ public async Task ConstructionGraphSpawnPrototypeValid()
[Test]
public async Task ConstructionGraphNodeEntityPrototypeValid()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
var protoMan = server.ResolveDependency();
@@ -115,7 +113,7 @@ public async Task ConstructionGraphNodeEntityPrototypeValid()
[Test]
public async Task ConstructionGraphEdgeValid()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
var protoMan = server.ResolveDependency();
diff --git a/Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs b/Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs
index d9021a0a277..f23e2932488 100644
--- a/Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs
+++ b/Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs
@@ -1,11 +1,9 @@
using Content.Server.Construction.Components;
using Content.Shared.Construction.Prototypes;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
-using System.Threading.Tasks;
namespace Content.IntegrationTests.Tests.Construction
{
@@ -22,7 +20,7 @@ public sealed class ConstructionPrototypeTest
[Test]
public async Task TestStartNodeValid()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
var entMan = server.ResolveDependency();
@@ -54,7 +52,7 @@ await server.WaitAssertion(() =>
[Test]
public async Task TestStartIsValid()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
var protoMan = server.ResolveDependency();
@@ -72,7 +70,7 @@ public async Task TestStartIsValid()
[Test]
public async Task TestTargetIsValid()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
var protoMan = server.ResolveDependency();
@@ -121,7 +119,7 @@ public async Task DeconstructionIsValid()
[Test]
public async Task TestStartReachesValidTarget()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
var protoMan = server.ResolveDependency();
@@ -131,12 +129,15 @@ public async Task TestStartReachesValidTarget()
var start = proto.StartNode;
var target = proto.TargetNode;
var graph = protoMan.Index(proto.Graph);
+
+#pragma warning disable NUnit2045 // Interdependent assertions.
Assert.That(graph.TryPath(start, target, out var path), $"Unable to find path from \"{start}\" to \"{target}\" on graph \"{graph.ID}\"");
- Assert.That(path!.Length, Is.GreaterThanOrEqualTo(1), $"Unable to find path from \"{start}\" to \"{target}\" on graph \"{graph.ID}\".");
+ Assert.That(path, Has.Length.GreaterThanOrEqualTo(1), $"Unable to find path from \"{start}\" to \"{target}\" on graph \"{graph.ID}\".");
var next = path[0];
Assert.That(next.Entity, Is.Not.Null, $"The next node ({next.Name}) in the path from the start node ({start}) to the target node ({target}) must specify an entity! Graph: {graph.ID}");
Assert.That(protoMan.TryIndex(next.Entity, out EntityPrototype entity), $"The next node ({next.Name}) in the path from the start node ({start}) to the target node ({target}) specified an invalid entity prototype ({next.Entity})");
Assert.That(entity.Components.ContainsKey("Construction"), $"The next node ({next.Name}) in the path from the start node ({start}) to the target node ({target}) specified an entity prototype ({next.Entity}) without a ConstructionComponent.");
+#pragma warning restore NUnit2045
}
await pairTracker.CleanReturnAsync();
}
diff --git a/Content.IntegrationTests/Tests/Construction/Interaction/ComputerContruction.cs b/Content.IntegrationTests/Tests/Construction/Interaction/ComputerContruction.cs
index aade73e7018..87f3c06c12b 100644
--- a/Content.IntegrationTests/Tests/Construction/Interaction/ComputerContruction.cs
+++ b/Content.IntegrationTests/Tests/Construction/Interaction/ComputerContruction.cs
@@ -1,6 +1,4 @@
-using System.Threading.Tasks;
using Content.IntegrationTests.Tests.Interaction;
-using NUnit.Framework;
namespace Content.IntegrationTests.Tests.Construction.Interaction;
diff --git a/Content.IntegrationTests/Tests/Construction/Interaction/CraftingTests.cs b/Content.IntegrationTests/Tests/Construction/Interaction/CraftingTests.cs
index 698f81b1226..5c48703dff6 100644
--- a/Content.IntegrationTests/Tests/Construction/Interaction/CraftingTests.cs
+++ b/Content.IntegrationTests/Tests/Construction/Interaction/CraftingTests.cs
@@ -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 async Task CancelCraft()
await RunTicks(5);
var sys = SEntMan.System();
- 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
}
-
diff --git a/Content.IntegrationTests/Tests/Construction/Interaction/GrilleWindowConstruction.cs b/Content.IntegrationTests/Tests/Construction/Interaction/GrilleWindowConstruction.cs
index 69ea71f10e2..1a2f4bcda14 100644
--- a/Content.IntegrationTests/Tests/Construction/Interaction/GrilleWindowConstruction.cs
+++ b/Content.IntegrationTests/Tests/Construction/Interaction/GrilleWindowConstruction.cs
@@ -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;
diff --git a/Content.IntegrationTests/Tests/Construction/Interaction/MachineConstruction.cs b/Content.IntegrationTests/Tests/Construction/Interaction/MachineConstruction.cs
index 6f0478a6521..0382912ccbb 100644
--- a/Content.IntegrationTests/Tests/Construction/Interaction/MachineConstruction.cs
+++ b/Content.IntegrationTests/Tests/Construction/Interaction/MachineConstruction.cs
@@ -1,6 +1,4 @@
-using System.Threading.Tasks;
using Content.IntegrationTests.Tests.Interaction;
-using NUnit.Framework;
namespace Content.IntegrationTests.Tests.Construction.Interaction;
diff --git a/Content.IntegrationTests/Tests/Construction/Interaction/PanelScrewing.cs b/Content.IntegrationTests/Tests/Construction/Interaction/PanelScrewing.cs
index f6ca9ec72e7..2f69f3abea5 100644
--- a/Content.IntegrationTests/Tests/Construction/Interaction/PanelScrewing.cs
+++ b/Content.IntegrationTests/Tests/Construction/Interaction/PanelScrewing.cs
@@ -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;
diff --git a/Content.IntegrationTests/Tests/Construction/Interaction/PlaceableDeconstruction.cs b/Content.IntegrationTests/Tests/Construction/Interaction/PlaceableDeconstruction.cs
index 1ce57422dd0..bc0cb9bcef3 100644
--- a/Content.IntegrationTests/Tests/Construction/Interaction/PlaceableDeconstruction.cs
+++ b/Content.IntegrationTests/Tests/Construction/Interaction/PlaceableDeconstruction.cs
@@ -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;
diff --git a/Content.IntegrationTests/Tests/Construction/Interaction/WallConstruction.cs b/Content.IntegrationTests/Tests/Construction/Interaction/WallConstruction.cs
index 5cdb00ce95c..05cf8cac1b8 100644
--- a/Content.IntegrationTests/Tests/Construction/Interaction/WallConstruction.cs
+++ b/Content.IntegrationTests/Tests/Construction/Interaction/WallConstruction.cs
@@ -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 async Task ConstructWall()
{
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 async Task DeconstructWall()
await AssertEntityLookup((Steel, 4));
}
}
-
diff --git a/Content.IntegrationTests/Tests/Construction/Interaction/WindowConstruction.cs b/Content.IntegrationTests/Tests/Construction/Interaction/WindowConstruction.cs
index 60deadcaeea..2be20202775 100644
--- a/Content.IntegrationTests/Tests/Construction/Interaction/WindowConstruction.cs
+++ b/Content.IntegrationTests/Tests/Construction/Interaction/WindowConstruction.cs
@@ -1,6 +1,4 @@
-using System.Threading.Tasks;
using Content.IntegrationTests.Tests.Interaction;
-using NUnit.Framework;
namespace Content.IntegrationTests.Tests.Construction.Interaction;
diff --git a/Content.IntegrationTests/Tests/Construction/Interaction/WindowRepair.cs b/Content.IntegrationTests/Tests/Construction/Interaction/WindowRepair.cs
index 0c104a41be3..e04fbfd1429 100644
--- a/Content.IntegrationTests/Tests/Construction/Interaction/WindowRepair.cs
+++ b/Content.IntegrationTests/Tests/Construction/Interaction/WindowRepair.cs
@@ -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;
diff --git a/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs b/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs
index 0ea036d8e12..089950aa192 100644
--- a/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs
+++ b/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs
@@ -1,11 +1,6 @@
-using System.Linq;
-using System.Threading.Tasks;
-using Content.Server.Storage.Components;
using Content.Server.Storage.EntitySystems;
-using NUnit.Framework;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
@@ -37,7 +32,7 @@ public sealed class ContainerOcclusionTest
[Test]
public async Task TestA()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { ExtraPrototypes = Prototypes });
var s = pairTracker.Pair.Server;
var c = pairTracker.Pair.Client;
@@ -64,8 +59,11 @@ await c.WaitAssertion(() =>
{
var sprite = cEntities.GetComponent(dummy);
var light = cEntities.GetComponent(dummy);
- Assert.True(sprite.ContainerOccluded);
- Assert.True(light.ContainerOccluded);
+ Assert.Multiple(() =>
+ {
+ Assert.That(sprite.ContainerOccluded);
+ Assert.That(light.ContainerOccluded);
+ });
});
await pairTracker.CleanReturnAsync();
@@ -74,7 +72,7 @@ await c.WaitAssertion(() =>
[Test]
public async Task TestB()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { ExtraPrototypes = Prototypes });
var s = pairTracker.Pair.Server;
var c = pairTracker.Pair.Client;
@@ -101,8 +99,11 @@ await c.WaitAssertion(() =>
{
var sprite = cEntities.GetComponent(dummy);
var light = cEntities.GetComponent(dummy);
- Assert.False(sprite.ContainerOccluded);
- Assert.False(light.ContainerOccluded);
+ Assert.Multiple(() =>
+ {
+ Assert.That(sprite.ContainerOccluded, Is.False);
+ Assert.That(light.ContainerOccluded, Is.False);
+ });
});
await pairTracker.CleanReturnAsync();
@@ -111,7 +112,7 @@ await c.WaitAssertion(() =>
[Test]
public async Task TestAb()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { ExtraPrototypes = Prototypes });
var s = pairTracker.Pair.Server;
var c = pairTracker.Pair.Client;
@@ -140,8 +141,11 @@ await c.WaitAssertion(() =>
{
var sprite = cEntities.GetComponent(dummy);
var light = cEntities.GetComponent(dummy);
- Assert.True(sprite.ContainerOccluded);
- Assert.True(light.ContainerOccluded);
+ Assert.Multiple(() =>
+ {
+ Assert.That(sprite.ContainerOccluded);
+ Assert.That(light.ContainerOccluded);
+ });
});
await pairTracker.CleanReturnAsync();
diff --git a/Content.IntegrationTests/Tests/Damageable/DamageSpecifierTest.cs b/Content.IntegrationTests/Tests/Damageable/DamageSpecifierTest.cs
index 67658d18ce7..41d17ddedae 100644
--- a/Content.IntegrationTests/Tests/Damageable/DamageSpecifierTest.cs
+++ b/Content.IntegrationTests/Tests/Damageable/DamageSpecifierTest.cs
@@ -1,7 +1,6 @@
using System.Collections.Generic;
using Content.Shared.Damage;
using Content.Shared.FixedPoint;
-using NUnit.Framework;
namespace Content.IntegrationTests.Tests.Damageable;
@@ -23,9 +22,12 @@ public void TestDamageSpecifierOperations()
DamageSpecifier output4 = new() { DamageDict = _output4 };
DamageSpecifier output5 = new() { DamageDict = _output5 };
- Assert.That((-input1).Equals(output1));
- Assert.That((input1 / 2).Equals(output2));
- Assert.That((input1 * 2).Equals(output3));
+ Assert.Multiple(() =>
+ {
+ Assert.That((-input1).Equals(output1));
+ Assert.That((input1 / 2).Equals(output2));
+ Assert.That((input1 * 2).Equals(output3));
+ });
var difference = (input1 - input2);
Assert.That(difference.Equals(output4));
diff --git a/Content.IntegrationTests/Tests/Damageable/DamageableTest.cs b/Content.IntegrationTests/Tests/Damageable/DamageableTest.cs
index 9920e15e021..7099eb4326a 100644
--- a/Content.IntegrationTests/Tests/Damageable/DamageableTest.cs
+++ b/Content.IntegrationTests/Tests/Damageable/DamageableTest.cs
@@ -1,9 +1,7 @@
using System.Linq;
-using System.Threading.Tasks;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.FixedPoint;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
@@ -74,7 +72,11 @@ public sealed class DamageableTest
[Test]
public async Task TestDamageableComponents()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var sEntityManager = server.ResolveDependency();
@@ -97,7 +99,7 @@ public async Task TestDamageableComponents()
DamageTypePrototype type3b = default!;
DamageTypePrototype type3c = default!;
- FixedPoint2 typeDamage, groupDamage;
+ FixedPoint2 typeDamage;
await server.WaitPost(() =>
{
@@ -127,74 +129,94 @@ await server.WaitAssertion(() =>
var uid = sDamageableEntity;
// Check that the correct types are supported.
- Assert.That(sDamageableComponent.Damage.DamageDict.ContainsKey(type1.ID), Is.False);
- Assert.That(sDamageableComponent.Damage.DamageDict.ContainsKey(type2a.ID), Is.True);
- Assert.That(sDamageableComponent.Damage.DamageDict.ContainsKey(type2b.ID), Is.False);
- Assert.That(sDamageableComponent.Damage.DamageDict.ContainsKey(type3a.ID), Is.True);
- Assert.That(sDamageableComponent.Damage.DamageDict.ContainsKey(type3b.ID), Is.True);
- Assert.That(sDamageableComponent.Damage.DamageDict.ContainsKey(type3c.ID), Is.True);
+ Assert.Multiple(() =>
+ {
+ Assert.That(sDamageableComponent.Damage.DamageDict.ContainsKey(type1.ID), Is.False);
+ Assert.That(sDamageableComponent.Damage.DamageDict.ContainsKey(type2a.ID), Is.True);
+ Assert.That(sDamageableComponent.Damage.DamageDict.ContainsKey(type2b.ID), Is.False);
+ Assert.That(sDamageableComponent.Damage.DamageDict.ContainsKey(type3a.ID), Is.True);
+ Assert.That(sDamageableComponent.Damage.DamageDict.ContainsKey(type3b.ID), Is.True);
+ Assert.That(sDamageableComponent.Damage.DamageDict.ContainsKey(type3c.ID), Is.True);
+ });
// Check that damage is evenly distributed over a group if its a nice multiple
var types = group3.DamageTypes;
- var damageToDeal = FixedPoint2.New(types.Count() * 5);
+ var damageToDeal = FixedPoint2.New(types.Count * 5);
DamageSpecifier damage = new(group3, damageToDeal);
sDamageableSystem.TryChangeDamage(uid, damage, true);
- Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(damageToDeal));
- Assert.That(sDamageableComponent.DamagePerGroup[group3.ID], Is.EqualTo(damageToDeal));
- foreach (var type in types)
+ Assert.Multiple(() =>
{
- Assert.That(sDamageableComponent.Damage.DamageDict.TryGetValue(type, out typeDamage));
- Assert.That(typeDamage, Is.EqualTo(damageToDeal / types.Count()));
- }
+ Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(damageToDeal));
+ Assert.That(sDamageableComponent.DamagePerGroup[group3.ID], Is.EqualTo(damageToDeal));
+ foreach (var type in types)
+ {
+ Assert.That(sDamageableComponent.Damage.DamageDict.TryGetValue(type, out typeDamage));
+ Assert.That(typeDamage, Is.EqualTo(damageToDeal / types.Count));
+ }
+ });
// Heal
sDamageableSystem.TryChangeDamage(uid, -damage);
- Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.Zero));
- Assert.That(sDamageableComponent.DamagePerGroup[group3.ID], Is.EqualTo(FixedPoint2.Zero));
- foreach (var type in types)
+ Assert.Multiple(() =>
{
- Assert.That(sDamageableComponent.Damage.DamageDict.TryGetValue(type, out typeDamage));
- Assert.That(typeDamage, Is.EqualTo(FixedPoint2.Zero));
- }
+ Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.Zero));
+ Assert.That(sDamageableComponent.DamagePerGroup[group3.ID], Is.EqualTo(FixedPoint2.Zero));
+ foreach (var type in types)
+ {
+ Assert.That(sDamageableComponent.Damage.DamageDict.TryGetValue(type, out typeDamage));
+ Assert.That(typeDamage, Is.EqualTo(FixedPoint2.Zero));
+ }
+ });
// Check that damage works properly if it is NOT perfectly divisible among group members
types = group3.DamageTypes;
- damageToDeal = FixedPoint2.New(types.Count() * 5 - 1);
+ damageToDeal = FixedPoint2.New(types.Count * 5 - 1);
damage = new DamageSpecifier(group3, damageToDeal);
sDamageableSystem.TryChangeDamage(uid, damage, true);
- Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(damageToDeal));
- Assert.That(sDamageableComponent.DamagePerGroup[group3.ID], Is.EqualTo(damageToDeal));
- Assert.That(sDamageableComponent.Damage.DamageDict[type3a.ID], Is.EqualTo(damageToDeal / types.Count()));
- Assert.That(sDamageableComponent.Damage.DamageDict[type3b.ID], Is.EqualTo(damageToDeal / types.Count()));
+ Assert.Multiple(() =>
+ {
+ Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(damageToDeal));
+ Assert.That(sDamageableComponent.DamagePerGroup[group3.ID], Is.EqualTo(damageToDeal));
+ Assert.That(sDamageableComponent.Damage.DamageDict[type3a.ID], Is.EqualTo(damageToDeal / types.Count));
+ Assert.That(sDamageableComponent.Damage.DamageDict[type3b.ID], Is.EqualTo(damageToDeal / types.Count));
- // last one will get 0.01 less, since its not perfectly divisble by 3
- Assert.That(sDamageableComponent.Damage.DamageDict[type3c.ID], Is.EqualTo(damageToDeal / types.Count() - 0.01));
+ // last one will get 0.01 less, since its not perfectly divisble by 3
+ Assert.That(sDamageableComponent.Damage.DamageDict[type3c.ID], Is.EqualTo(damageToDeal / types.Count - 0.01));
+ });
// Heal
sDamageableSystem.TryChangeDamage(uid, -damage);
- Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.Zero));
- Assert.That(sDamageableComponent.DamagePerGroup[group3.ID], Is.EqualTo(FixedPoint2.Zero));
- foreach (var type in types)
- {
- Assert.That(sDamageableComponent.Damage.DamageDict.TryGetValue(type, out typeDamage));
- Assert.That(typeDamage, Is.EqualTo(FixedPoint2.Zero));
- }
- // Test that unsupported groups return false when setting/getting damage (and don't change damage)
- Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.Zero));
+ Assert.Multiple(() =>
+ {
+ Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.Zero));
+ Assert.That(sDamageableComponent.DamagePerGroup[group3.ID], Is.EqualTo(FixedPoint2.Zero));
+ foreach (var type in types)
+ {
+ Assert.That(sDamageableComponent.Damage.DamageDict.TryGetValue(type, out typeDamage));
+ Assert.That(typeDamage, Is.EqualTo(FixedPoint2.Zero));
+ }
+
+ // Test that unsupported groups return false when setting/getting damage (and don't change damage)
+ Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.Zero));
+ });
damage = new DamageSpecifier(group1, FixedPoint2.New(10)) + new DamageSpecifier(type2b, FixedPoint2.New(10));
sDamageableSystem.TryChangeDamage(uid, damage, true);
- Assert.That(sDamageableComponent.DamagePerGroup.TryGetValue(group1.ID, out groupDamage), Is.False);
- Assert.That(sDamageableComponent.Damage.DamageDict.TryGetValue(type1.ID, out typeDamage), Is.False);
- Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.Zero));
+
+ Assert.Multiple(() =>
+ {
+ Assert.That(sDamageableComponent.DamagePerGroup.TryGetValue(group1.ID, out _), Is.False);
+ Assert.That(sDamageableComponent.Damage.DamageDict.TryGetValue(type1.ID, out typeDamage), Is.False);
+ Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.Zero));
+ });
// Test SetAll function
sDamageableSystem.SetAllDamage(sDamageableEntity, sDamageableComponent, 10);
- Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.New(10 * sDamageableComponent.Damage.DamageDict.Count())));
+ Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.New(10 * sDamageableComponent.Damage.DamageDict.Count)));
sDamageableSystem.SetAllDamage(sDamageableEntity, sDamageableComponent, 0);
Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.Zero));
@@ -202,9 +224,13 @@ await server.WaitAssertion(() =>
sDamageableSystem.TryChangeDamage(uid, new DamageSpecifier(type3a, 5));
sDamageableSystem.TryChangeDamage(uid, new DamageSpecifier(type3b, 7));
sDamageableSystem.TryChangeDamage(uid, new DamageSpecifier(group3, -11));
- Assert.That(sDamageableComponent.Damage.DamageDict[type3a.ID], Is.EqualTo(FixedPoint2.New(1.33)));
- Assert.That(sDamageableComponent.Damage.DamageDict[type3b.ID], Is.EqualTo(FixedPoint2.New(3.33)));
- Assert.That(sDamageableComponent.Damage.DamageDict[type3c.ID], Is.EqualTo(FixedPoint2.New(0)));
+
+ Assert.Multiple(() =>
+ {
+ Assert.That(sDamageableComponent.Damage.DamageDict[type3a.ID], Is.EqualTo(FixedPoint2.New(1.33)));
+ Assert.That(sDamageableComponent.Damage.DamageDict[type3b.ID], Is.EqualTo(FixedPoint2.New(3.33)));
+ Assert.That(sDamageableComponent.Damage.DamageDict[type3c.ID], Is.EqualTo(FixedPoint2.New(0)));
+ });
// Test Over-Healing
sDamageableSystem.TryChangeDamage(uid, new DamageSpecifier(group3, FixedPoint2.New(-100)));
diff --git a/Content.IntegrationTests/Tests/DeleteInventoryTest.cs b/Content.IntegrationTests/Tests/DeleteInventoryTest.cs
index d1d557964b4..af897a611ee 100644
--- a/Content.IntegrationTests/Tests/DeleteInventoryTest.cs
+++ b/Content.IntegrationTests/Tests/DeleteInventoryTest.cs
@@ -1,11 +1,8 @@
-using System.Threading.Tasks;
using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.EntitySystems;
using Content.Shared.Inventory;
-using NUnit.Framework;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
namespace Content.IntegrationTests.Tests
{
@@ -17,7 +14,7 @@ public sealed class DeleteInventoryTest
[Test]
public async Task Test()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
var entMgr = server.ResolveDependency();
diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageGroupTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageGroupTest.cs
index aa54ad5a389..8b5452a507e 100644
--- a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageGroupTest.cs
+++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageGroupTest.cs
@@ -1,9 +1,7 @@
-using System.Threading.Tasks;
using Content.Server.Destructible.Thresholds.Triggers;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.FixedPoint;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
@@ -20,7 +18,11 @@ public sealed class DestructibleDamageGroupTest
[Test]
public async Task AndTest()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
@@ -51,7 +53,7 @@ await server.WaitPost(() =>
await server.WaitAssertion(() =>
{
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
});
await server.WaitAssertion(() =>
@@ -66,34 +68,40 @@ await server.WaitAssertion(() =>
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage, true);
// No thresholds reached yet, the earliest one is at 10 damage
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Raise brute damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage, true);
// No threshold reached, burn needs to be 10 as well
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Raise burn damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity, burnDamage * 2, true);
// One threshold reached, brute 10 + burn 10
- Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(1));
// Threshold brute 10 + burn 10
var msg = sTestThresholdListenerSystem.ThresholdsReached[0];
var threshold = msg.Threshold;
// Check that it matches the YAML prototype
- Assert.That(threshold.Behaviors, Is.Empty);
- Assert.NotNull(threshold.Trigger);
- Assert.That(threshold.Triggered, Is.True);
- Assert.IsInstanceOf(threshold.Trigger);
+ Assert.Multiple(() =>
+ {
+ Assert.That(threshold.Behaviors, Is.Empty);
+ Assert.That(threshold.Trigger, Is.Not.Null);
+ Assert.That(threshold.Triggered, Is.True);
+ Assert.That(threshold.Trigger, Is.InstanceOf());
+ });
var trigger = (AndTrigger) threshold.Trigger;
- Assert.IsInstanceOf(trigger.Triggers[0]);
- Assert.IsInstanceOf(trigger.Triggers[1]);
+ Assert.Multiple(() =>
+ {
+ Assert.That(trigger.Triggers[0], Is.InstanceOf());
+ Assert.That(trigger.Triggers[1], Is.InstanceOf());
+ });
sTestThresholdListenerSystem.ThresholdsReached.Clear();
@@ -101,26 +109,29 @@ await server.WaitAssertion(() =>
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage * 2, true);
// No new thresholds reached
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Raise burn damage to 20
sDamageableSystem.TryChangeDamage(sDestructibleEntity, burnDamage * 2, true);
// No new thresholds reached
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Lower brute damage to 0
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage * -10);
- Assert.That(sDamageableComponent.TotalDamage,Is.EqualTo(FixedPoint2.New(20)));
+ Assert.Multiple(() =>
+ {
+ Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.New(20)));
- // No new thresholds reached, healing should not trigger it
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ // No new thresholds reached, healing should not trigger it
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
+ });
// Raise brute damage back up to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage * 2, true);
// 10 brute + 10 burn threshold reached, brute was healed and brought back to its threshold amount and slash stayed the same
- Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(1));
sTestThresholdListenerSystem.ThresholdsReached.Clear();
@@ -128,34 +139,40 @@ await server.WaitAssertion(() =>
sDamageableSystem.SetAllDamage(sDestructibleEntity, sDamageableComponent, 0);
// No new thresholds reached, healing should not trigger it
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Raise brute damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage * 2, true);
// No new thresholds reached
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Raise burn damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity, burnDamage * 2, true);
// Both classes of damage were healed and then raised again, the threshold should have been reached as triggers once is default false
- Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(1));
// Threshold brute 10 + burn 10
msg = sTestThresholdListenerSystem.ThresholdsReached[0];
threshold = msg.Threshold;
// Check that it matches the YAML prototype
- Assert.That(threshold.Behaviors, Is.Empty);
- Assert.NotNull(threshold.Trigger);
- Assert.That(threshold.Triggered, Is.True);
- Assert.IsInstanceOf(threshold.Trigger);
+ Assert.Multiple(() =>
+ {
+ Assert.That(threshold.Behaviors, Is.Empty);
+ Assert.That(threshold.Trigger, Is.Not.Null);
+ Assert.That(threshold.Triggered, Is.True);
+ Assert.That(threshold.Trigger, Is.InstanceOf());
+ });
trigger = (AndTrigger) threshold.Trigger;
- Assert.IsInstanceOf(trigger.Triggers[0]);
- Assert.IsInstanceOf(trigger.Triggers[1]);
+ Assert.Multiple(() =>
+ {
+ Assert.That(trigger.Triggers[0], Is.InstanceOf());
+ Assert.That(trigger.Triggers[1], Is.InstanceOf());
+ });
sTestThresholdListenerSystem.ThresholdsReached.Clear();
@@ -166,19 +183,19 @@ await server.WaitAssertion(() =>
sDamageableSystem.SetAllDamage(sDestructibleEntity, sDamageableComponent, 0);
// No new thresholds reached from healing
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Raise brute damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage * 2, true);
// No new thresholds reached
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Raise burn damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity, burnDamage * 2, true);
// No new thresholds reached as triggers once is set to true and it already triggered before
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
});
await pairTracker.CleanReturnAsync();
}
diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs
index 3cc917add90..8352585a393 100644
--- a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs
+++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs
@@ -1,11 +1,7 @@
-using System.Threading.Tasks;
using Content.Server.Destructible.Thresholds.Triggers;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
-using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
@@ -19,7 +15,11 @@ public sealed class DestructibleDamageTypeTest
[Test]
public async Task Test()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
@@ -48,7 +48,7 @@ await server.WaitPost(() =>
await server.WaitAssertion(() =>
{
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
});
await server.WaitAssertion(() =>
@@ -56,41 +56,47 @@ await server.WaitAssertion(() =>
var bluntDamageType = protoManager.Index("TestBlunt");
var slashDamageType = protoManager.Index("TestSlash");
- var bluntDamage = new DamageSpecifier(bluntDamageType,5);
- var slashDamage = new DamageSpecifier(slashDamageType,5);
+ var bluntDamage = new DamageSpecifier(bluntDamageType, 5);
+ var slashDamage = new DamageSpecifier(slashDamageType, 5);
// Raise blunt damage to 5
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true);
// No thresholds reached yet, the earliest one is at 10 damage
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Raise blunt damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true);
// No threshold reached, slash needs to be 10 as well
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Raise slash damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * 2, true);
// One threshold reached, blunt 10 + slash 10
- Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(1));
// Threshold blunt 10 + slash 10
var msg = sTestThresholdListenerSystem.ThresholdsReached[0];
var threshold = msg.Threshold;
// Check that it matches the YAML prototype
- Assert.That(threshold.Behaviors, Is.Empty);
- Assert.NotNull(threshold.Trigger);
- Assert.That(threshold.Triggered, Is.True);
- Assert.IsInstanceOf(threshold.Trigger);
+ Assert.Multiple(() =>
+ {
+ Assert.That(threshold.Behaviors, Is.Empty);
+ Assert.That(threshold.Trigger, Is.Not.Null);
+ Assert.That(threshold.Triggered, Is.True);
+ Assert.That(threshold.Trigger, Is.InstanceOf());
+ });
var trigger = (AndTrigger) threshold.Trigger;
- Assert.IsInstanceOf(trigger.Triggers[0]);
- Assert.IsInstanceOf(trigger.Triggers[1]);
+ Assert.Multiple(() =>
+ {
+ Assert.That(trigger.Triggers[0], Is.InstanceOf());
+ Assert.That(trigger.Triggers[1], Is.InstanceOf());
+ });
sTestThresholdListenerSystem.ThresholdsReached.Clear();
@@ -98,25 +104,25 @@ await server.WaitAssertion(() =>
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 2, true);
// No new thresholds reached
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Raise slash damage to 20
sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * 2, true);
// No new thresholds reached
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Lower blunt damage to 0
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * -4, true);
// No new thresholds reached, healing should not trigger it
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Raise blunt damage back up to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 2, true);
// 10 blunt + 10 slash threshold reached, blunt was healed and brought back to its threshold amount and slash stayed the same
- Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(1));
sTestThresholdListenerSystem.ThresholdsReached.Clear();
@@ -125,34 +131,40 @@ await server.WaitAssertion(() =>
sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * -4, true);
// No new thresholds reached, healing should not trigger it
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Raise blunt damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 2, true);
// No new thresholds reached
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Raise slash damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * 2, true);
// Both types of damage were healed and then raised again, the threshold should have been reached as triggers once is default false
- Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(1));
// Threshold blunt 10 + slash 10
msg = sTestThresholdListenerSystem.ThresholdsReached[0];
threshold = msg.Threshold;
// Check that it matches the YAML prototype
- Assert.That(threshold.Behaviors, Is.Empty);
- Assert.NotNull(threshold.Trigger);
- Assert.That(threshold.Triggered, Is.True);
- Assert.IsInstanceOf(threshold.Trigger);
+ Assert.Multiple(() =>
+ {
+ Assert.That(threshold.Behaviors, Is.Empty);
+ Assert.That(threshold.Trigger, Is.Not.Null);
+ Assert.That(threshold.Triggered, Is.True);
+ Assert.That(threshold.Trigger, Is.InstanceOf());
+ });
trigger = (AndTrigger) threshold.Trigger;
- Assert.IsInstanceOf(trigger.Triggers[0]);
- Assert.IsInstanceOf(trigger.Triggers[1]);
+ Assert.Multiple(() =>
+ {
+ Assert.That(trigger.Triggers[0], Is.InstanceOf());
+ Assert.That(trigger.Triggers[1], Is.InstanceOf());
+ });
sTestThresholdListenerSystem.ThresholdsReached.Clear();
@@ -164,19 +176,19 @@ await server.WaitAssertion(() =>
sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * -2, true);
// No new thresholds reached from healing
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Raise blunt damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 2, true);
// No new thresholds reached
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Raise slash damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * 2, true);
// No new thresholds reached as triggers once is set to true and it already triggered before
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
});
await pairTracker.CleanReturnAsync();
}
diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs
index c8a38734e76..0373f0d5edc 100644
--- a/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs
+++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs
@@ -1,13 +1,9 @@
using System.Linq;
-using System.Threading.Tasks;
using Content.Server.Destructible.Thresholds;
using Content.Server.Destructible.Thresholds.Behaviors;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
-using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
@@ -18,7 +14,11 @@ public sealed class DestructibleDestructionTest
[Test]
public async Task Test()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
@@ -43,27 +43,35 @@ await server.WaitAssertion(() =>
{
var coordinates = sEntityManager.GetComponent(sDestructibleEntity).Coordinates;
var bruteDamageGroup = sPrototypeManager.Index("TestBrute");
- DamageSpecifier bruteDamage = new(bruteDamageGroup,50);
+ DamageSpecifier bruteDamage = new(bruteDamageGroup, 50);
+#pragma warning disable NUnit2045 // Interdependent assertions.
Assert.DoesNotThrow(() =>
{
- EntitySystem.Get().TryChangeDamage(sDestructibleEntity, bruteDamage, true);
+ sEntityManager.System().TryChangeDamage(sDestructibleEntity, bruteDamage, true);
});
- Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(1));
+#pragma warning restore NUnit2045
var threshold = sTestThresholdListenerSystem.ThresholdsReached[0].Threshold;
- Assert.That(threshold.Triggered, Is.True);
- Assert.That(threshold.Behaviors.Count, Is.EqualTo(3));
+ Assert.Multiple(() =>
+ {
+ Assert.That(threshold.Triggered, Is.True);
+ Assert.That(threshold.Behaviors, Has.Count.EqualTo(3));
+ });
var spawnEntitiesBehavior = (SpawnEntitiesBehavior) threshold.Behaviors.Single(b => b is SpawnEntitiesBehavior);
- Assert.That(spawnEntitiesBehavior.Spawn.Count, Is.EqualTo(1));
- Assert.That(spawnEntitiesBehavior.Spawn.Keys.Single(), Is.EqualTo(SpawnedEntityId));
- Assert.That(spawnEntitiesBehavior.Spawn.Values.Single(), Is.EqualTo(new MinMax {Min = 1, Max = 1}));
+ Assert.Multiple(() =>
+ {
+ Assert.That(spawnEntitiesBehavior.Spawn, Has.Count.EqualTo(1));
+ Assert.That(spawnEntitiesBehavior.Spawn.Keys.Single(), Is.EqualTo(SpawnedEntityId));
+ Assert.That(spawnEntitiesBehavior.Spawn.Values.Single(), Is.EqualTo(new MinMax { Min = 1, Max = 1 }));
+ });
- var entitiesInRange = EntitySystem.Get().GetEntitiesInRange(coordinates, 2);
+ var entitiesInRange = sEntityManager.System().GetEntitiesInRange(coordinates, 2);
var found = false;
foreach (var entity in entitiesInRange)
diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs
index 863a0df31c5..519040ab465 100644
--- a/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs
+++ b/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs
@@ -1,5 +1,4 @@
using System.Linq;
-using System.Threading.Tasks;
using Content.Server.Destructible;
using Content.Server.Destructible.Thresholds;
using Content.Server.Destructible.Thresholds.Behaviors;
@@ -7,10 +6,7 @@
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.FixedPoint;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
-using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
@@ -24,7 +20,11 @@ public sealed class DestructibleThresholdActivationTest
[Test]
public async Task Test()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var sEntityManager = server.ResolveDependency();
@@ -58,7 +58,7 @@ await server.WaitPost(() =>
await server.WaitAssertion(() =>
{
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
});
await server.WaitAssertion(() =>
@@ -68,28 +68,31 @@ await server.WaitAssertion(() =>
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true);
// No thresholds reached yet, the earliest one is at 20 damage
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true);
// Only one threshold reached, 20
- Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(1));
// Threshold 20
var msg = sTestThresholdListenerSystem.ThresholdsReached[0];
var threshold = msg.Threshold;
// Check that it matches the YAML prototype
- Assert.That(threshold.Behaviors, Is.Empty);
- Assert.NotNull(threshold.Trigger);
- Assert.That(threshold.Triggered, Is.True);
+ Assert.Multiple(() =>
+ {
+ Assert.That(threshold.Behaviors, Is.Empty);
+ Assert.That(threshold.Trigger, Is.Not.Null);
+ Assert.That(threshold.Triggered, Is.True);
+ });
sTestThresholdListenerSystem.ThresholdsReached.Clear();
- sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*3, true);
+ sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 3, true);
// One threshold reached, 50, since 20 already triggered before and it has not been healed below that amount
- Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(1));
// Threshold 50
msg = sTestThresholdListenerSystem.ThresholdsReached[0];
@@ -102,37 +105,40 @@ await server.WaitAssertion(() =>
var spawnThreshold = (SpawnEntitiesBehavior) threshold.Behaviors[1];
var actsThreshold = (DoActsBehavior) threshold.Behaviors[2];
- Assert.That(actsThreshold.Acts, Is.EqualTo(ThresholdActs.Breakage));
- Assert.That(audio.GetSound(soundThreshold.Sound), Is.EqualTo("/Audio/Effects/woodhit.ogg"));
- Assert.That(spawnThreshold.Spawn, Is.Not.Null);
- Assert.That(spawnThreshold.Spawn, Has.Count.EqualTo(1));
- Assert.That(spawnThreshold.Spawn.Single().Key, Is.EqualTo(SpawnedEntityId));
- Assert.That(spawnThreshold.Spawn.Single().Value.Min, Is.EqualTo(1));
- Assert.That(spawnThreshold.Spawn.Single().Value.Max, Is.EqualTo(1));
- Assert.NotNull(threshold.Trigger);
- Assert.That(threshold.Triggered, Is.True);
+ Assert.Multiple(() =>
+ {
+ Assert.That(actsThreshold.Acts, Is.EqualTo(ThresholdActs.Breakage));
+ Assert.That(audio.GetSound(soundThreshold.Sound), Is.EqualTo("/Audio/Effects/woodhit.ogg"));
+ Assert.That(spawnThreshold.Spawn, Is.Not.Null);
+ Assert.That(spawnThreshold.Spawn, Has.Count.EqualTo(1));
+ Assert.That(spawnThreshold.Spawn.Single().Key, Is.EqualTo(SpawnedEntityId));
+ Assert.That(spawnThreshold.Spawn.Single().Value.Min, Is.EqualTo(1));
+ Assert.That(spawnThreshold.Spawn.Single().Value.Max, Is.EqualTo(1));
+ Assert.That(threshold.Trigger, Is.Not.Null);
+ Assert.That(threshold.Triggered, Is.True);
+ });
sTestThresholdListenerSystem.ThresholdsReached.Clear();
// Damage for 50 again, up to 100 now
- sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*5, true);
+ sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 5, true);
// No thresholds reached as they weren't healed below the trigger amount
- Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Set damage to 0
sDamageableSystem.SetAllDamage(sDestructibleEntity, sDamageableComponent, 0);
// Damage for 100, up to 100
- sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*10, true);
+ sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 10, true);
// Two thresholds reached as damage increased past the previous, 20 and 50
- Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(2));
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(2));
sTestThresholdListenerSystem.ThresholdsReached.Clear();
// Heal the entity for 40 damage, down to 60
- sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*-4, true);
+ sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * -4, true);
// ThresholdsLookup don't work backwards
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
@@ -144,7 +150,7 @@ await server.WaitAssertion(() =>
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Heal by 30, down to 40
- sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*-3, true);
+ sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * -3, true);
// ThresholdsLookup don't work backwards
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
@@ -153,7 +159,7 @@ await server.WaitAssertion(() =>
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true);
// The 50 threshold should have triggered again, after being healed
- Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(1));
msg = sTestThresholdListenerSystem.ThresholdsReached[0];
threshold = msg.Threshold;
@@ -166,15 +172,18 @@ await server.WaitAssertion(() =>
actsThreshold = (DoActsBehavior) threshold.Behaviors[2];
// Check that it matches the YAML prototype
- Assert.That(actsThreshold.Acts, Is.EqualTo(ThresholdActs.Breakage));
- Assert.That(audio.GetSound(soundThreshold.Sound), Is.EqualTo("/Audio/Effects/woodhit.ogg"));
- Assert.That(spawnThreshold.Spawn, Is.Not.Null);
- Assert.That(spawnThreshold.Spawn.Count, Is.EqualTo(1));
- Assert.That(spawnThreshold.Spawn.Single().Key, Is.EqualTo(SpawnedEntityId));
- Assert.That(spawnThreshold.Spawn.Single().Value.Min, Is.EqualTo(1));
- Assert.That(spawnThreshold.Spawn.Single().Value.Max, Is.EqualTo(1));
- Assert.NotNull(threshold.Trigger);
- Assert.That(threshold.Triggered, Is.True);
+ Assert.Multiple(() =>
+ {
+ Assert.That(actsThreshold.Acts, Is.EqualTo(ThresholdActs.Breakage));
+ Assert.That(audio.GetSound(soundThreshold.Sound), Is.EqualTo("/Audio/Effects/woodhit.ogg"));
+ Assert.That(spawnThreshold.Spawn, Is.Not.Null);
+ Assert.That(spawnThreshold.Spawn, Has.Count.EqualTo(1));
+ Assert.That(spawnThreshold.Spawn.Single().Key, Is.EqualTo(SpawnedEntityId));
+ Assert.That(spawnThreshold.Spawn.Single().Value.Min, Is.EqualTo(1));
+ Assert.That(spawnThreshold.Spawn.Single().Value.Max, Is.EqualTo(1));
+ Assert.That(threshold.Trigger, Is.Not.Null);
+ Assert.That(threshold.Triggered, Is.True);
+ });
// Reset thresholds reached
sTestThresholdListenerSystem.ThresholdsReached.Clear();
@@ -183,19 +192,25 @@ await server.WaitAssertion(() =>
sDamageableSystem.SetAllDamage(sDestructibleEntity, sDamageableComponent, 0);
// Damage up to 50
- sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*5, true);
+ sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 5, true);
- // Check that the total damage matches
- Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.New(50)));
+ Assert.Multiple(() =>
+ {
+ // Check that the total damage matches
+ Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.New(50)));
- // Both thresholds should have triggered
- Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Exactly(2).Items);
+ // Both thresholds should have triggered
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Exactly(2).Items);
+ });
// Verify the first one, should be the lowest one (20)
msg = sTestThresholdListenerSystem.ThresholdsReached[0];
var trigger = (DamageTrigger) msg.Threshold.Trigger;
- Assert.NotNull(trigger);
- Assert.That(trigger.Damage, Is.EqualTo(20));
+ Assert.Multiple(() =>
+ {
+ Assert.That(trigger, Is.Not.Null);
+ Assert.That(trigger.Damage, Is.EqualTo(20));
+ });
threshold = msg.Threshold;
@@ -205,8 +220,11 @@ await server.WaitAssertion(() =>
// Verify the second one, should be the highest one (50)
msg = sTestThresholdListenerSystem.ThresholdsReached[1];
trigger = (DamageTrigger) msg.Threshold.Trigger;
- Assert.NotNull(trigger);
- Assert.That(trigger.Damage, Is.EqualTo(50));
+ Assert.Multiple(() =>
+ {
+ Assert.That(trigger, Is.Not.Null);
+ Assert.That(trigger.Damage, Is.EqualTo(50));
+ });
threshold = msg.Threshold;
@@ -217,15 +235,18 @@ await server.WaitAssertion(() =>
actsThreshold = (DoActsBehavior) threshold.Behaviors[2];
// Check that it matches the YAML prototype
- Assert.That(actsThreshold.Acts, Is.EqualTo(ThresholdActs.Breakage));
- Assert.That(soundThreshold.Sound.GetSound(), Is.EqualTo("/Audio/Effects/woodhit.ogg"));
- Assert.That(spawnThreshold.Spawn, Is.Not.Null);
- Assert.That(spawnThreshold.Spawn, Has.Count.EqualTo(1));
- Assert.That(spawnThreshold.Spawn.Single().Key, Is.EqualTo(SpawnedEntityId));
- Assert.That(spawnThreshold.Spawn.Single().Value.Min, Is.EqualTo(1));
- Assert.That(spawnThreshold.Spawn.Single().Value.Max, Is.EqualTo(1));
- Assert.NotNull(threshold.Trigger);
- Assert.That(threshold.Triggered, Is.True);
+ Assert.Multiple(() =>
+ {
+ Assert.That(actsThreshold.Acts, Is.EqualTo(ThresholdActs.Breakage));
+ Assert.That(audio.GetSound(soundThreshold.Sound), Is.EqualTo("/Audio/Effects/woodhit.ogg"));
+ Assert.That(spawnThreshold.Spawn, Is.Not.Null);
+ Assert.That(spawnThreshold.Spawn, Has.Count.EqualTo(1));
+ Assert.That(spawnThreshold.Spawn.Single().Key, Is.EqualTo(SpawnedEntityId));
+ Assert.That(spawnThreshold.Spawn.Single().Value.Min, Is.EqualTo(1));
+ Assert.That(spawnThreshold.Spawn.Single().Value.Max, Is.EqualTo(1));
+ Assert.That(threshold.Trigger, Is.Not.Null);
+ Assert.That(threshold.Triggered, Is.True);
+ });
// Reset thresholds reached
sTestThresholdListenerSystem.ThresholdsReached.Clear();
@@ -239,31 +260,37 @@ await server.WaitAssertion(() =>
// Set both thresholds to only trigger once
foreach (var destructibleThreshold in sDestructibleComponent.Thresholds)
{
- Assert.NotNull(destructibleThreshold.Trigger);
+ Assert.That(destructibleThreshold.Trigger, Is.Not.Null);
destructibleThreshold.TriggersOnce = true;
}
// Damage the entity up to 50 damage again
- sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*5, true);
+ sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 5, true);
- // Check that the total damage matches
- Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.New(50)));
+ Assert.Multiple(() =>
+ {
+ // Check that the total damage matches
+ Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.New(50)));
- // No thresholds should have triggered as they were already triggered before, and they are set to only trigger once
- Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
+ // No thresholds should have triggered as they were already triggered before, and they are set to only trigger once
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
+ });
// Set both thresholds to trigger multiple times
foreach (var destructibleThreshold in sDestructibleComponent.Thresholds)
{
- Assert.NotNull(destructibleThreshold.Trigger);
+ Assert.That(destructibleThreshold.Trigger, Is.Not.Null);
destructibleThreshold.TriggersOnce = false;
}
- // Check that the total damage matches
- Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.New(50)));
+ Assert.Multiple(() =>
+ {
+ // Check that the total damage matches
+ Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.New(50)));
- // They shouldn't have been triggered by changing TriggersOnce
- Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
+ // They shouldn't have been triggered by changing TriggersOnce
+ Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
+ });
});
await pairTracker.CleanReturnAsync();
}
diff --git a/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs b/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs
index ec62e716795..7c53522b5e7 100644
--- a/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs
+++ b/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs
@@ -1,8 +1,6 @@
-using System.Threading.Tasks;
using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Components;
using Content.Server.DeviceNetwork.Systems;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
@@ -51,7 +49,11 @@ public sealed class DeviceNetworkTest
[Test]
public async Task NetworkDeviceSendAndReceive()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var mapManager = server.ResolveDependency();
@@ -73,20 +75,27 @@ public async Task NetworkDeviceSendAndReceive()
["testbool"] = true
};
- await server.WaitAssertion(() => {
+ await server.WaitAssertion(() =>
+ {
device1 = entityManager.SpawnEntity("DummyNetworkDevice", MapCoordinates.Nullspace);
Assert.That(entityManager.TryGetComponent(device1, out networkComponent1), Is.True);
- Assert.That(networkComponent1.ReceiveFrequency != null, Is.True);
- Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty));
+ Assert.Multiple(() =>
+ {
+ Assert.That(networkComponent1.ReceiveFrequency, Is.Not.Null);
+ Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty));
+ });
device2 = entityManager.SpawnEntity("DummyNetworkDevice", MapCoordinates.Nullspace);
Assert.That(entityManager.TryGetComponent(device2, out networkComponent2), Is.True);
- Assert.That(networkComponent1.ReceiveFrequency != null, Is.True);
- Assert.That(networkComponent2.Address, Is.Not.EqualTo(string.Empty));
+ Assert.Multiple(() =>
+ {
+ Assert.That(networkComponent1.ReceiveFrequency, Is.Not.Null);
+ Assert.That(networkComponent2.Address, Is.Not.EqualTo(string.Empty));
- Assert.That(networkComponent1.Address, Is.Not.EqualTo(networkComponent2.Address));
+ Assert.That(networkComponent1.Address, Is.Not.EqualTo(networkComponent2.Address));
+ });
deviceNetSystem.QueuePacket(device1, networkComponent2.Address, payload, networkComponent2.ReceiveFrequency.Value);
});
@@ -94,7 +103,8 @@ await server.WaitAssertion(() => {
await server.WaitRunTicks(2);
await server.WaitIdleAsync();
- await server.WaitAssertion(() => {
+ await server.WaitAssertion(() =>
+ {
CollectionAssert.AreEquivalent(deviceNetTestSystem.LastPayload, payload);
});
await pairTracker.CleanReturnAsync();
@@ -103,7 +113,11 @@ await server.WaitAssertion(() => {
[Test]
public async Task WirelessNetworkDeviceSendAndReceive()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
var coordinates = testMap.GridCoords;
@@ -127,21 +141,32 @@ public async Task WirelessNetworkDeviceSendAndReceive()
["testbool"] = true
};
- await server.WaitAssertion(() => {
+ await server.WaitAssertion(() =>
+ {
device1 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", coordinates);
- Assert.That(entityManager.TryGetComponent(device1, out networkComponent1), Is.True);
- Assert.That(entityManager.TryGetComponent(device1, out wirelessNetworkComponent), Is.True);
- Assert.That(networkComponent1.ReceiveFrequency != null, Is.True);
- Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty));
+ Assert.Multiple(() =>
+ {
+ Assert.That(entityManager.TryGetComponent(device1, out networkComponent1), Is.True);
+ Assert.That(entityManager.TryGetComponent(device1, out wirelessNetworkComponent), Is.True);
+ });
+ Assert.Multiple(() =>
+ {
+ Assert.That(networkComponent1.ReceiveFrequency, Is.Not.Null);
+ Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty));
+ });
- device2 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", new MapCoordinates(new Robust.Shared.Maths.Vector2(0,50), testMap.MapId));
+ device2 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", new MapCoordinates(new Robust.Shared.Maths.Vector2(0, 50), testMap.MapId));
Assert.That(entityManager.TryGetComponent(device2, out networkComponent2), Is.True);
- Assert.That(networkComponent2.ReceiveFrequency != null, Is.True);
- Assert.That(networkComponent2.Address, Is.Not.EqualTo(string.Empty));
+ Assert.Multiple(() =>
+ {
+ Assert.That(networkComponent2.ReceiveFrequency, Is.Not.Null);
+ Assert.That(networkComponent2.Address, Is.Not.EqualTo(string.Empty));
+
+ Assert.That(networkComponent1.Address, Is.Not.EqualTo(networkComponent2.Address));
+ });
- Assert.That(networkComponent1.Address, Is.Not.EqualTo(networkComponent2.Address));
deviceNetSystem.QueuePacket(device1, networkComponent2.Address, payload, networkComponent2.ReceiveFrequency.Value);
});
@@ -149,7 +174,8 @@ await server.WaitAssertion(() => {
await server.WaitRunTicks(2);
await server.WaitIdleAsync();
- await server.WaitAssertion(() => {
+ await server.WaitAssertion(() =>
+ {
CollectionAssert.AreEqual(deviceNetTestSystem.LastPayload, payload);
payload = new NetworkPayload
@@ -165,7 +191,8 @@ await server.WaitAssertion(() => {
await server.WaitRunTicks(1);
await server.WaitIdleAsync();
- await server.WaitAssertion(() => {
+ await server.WaitAssertion(() =>
+ {
CollectionAssert.AreNotEqual(deviceNetTestSystem.LastPayload, payload);
});
@@ -175,7 +202,11 @@ await server.WaitAssertion(() => {
[Test]
public async Task WiredNetworkDeviceSendAndReceive()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
var coordinates = testMap.GridCoords;
@@ -190,7 +221,7 @@ public async Task WiredNetworkDeviceSendAndReceive()
DeviceNetworkComponent networkComponent1 = null;
DeviceNetworkComponent networkComponent2 = null;
WiredNetworkComponent wiredNetworkComponent = null;
- MapGridComponent grid = testMap.MapGrid;
+ var grid = testMap.MapGrid;
var testValue = "test";
var payload = new NetworkPayload
@@ -203,21 +234,31 @@ public async Task WiredNetworkDeviceSendAndReceive()
await server.WaitRunTicks(2);
await server.WaitIdleAsync();
- await server.WaitAssertion(() => {
+ await server.WaitAssertion(() =>
+ {
device1 = entityManager.SpawnEntity("DummyWiredNetworkDevice", coordinates);
- Assert.That(entityManager.TryGetComponent(device1, out networkComponent1), Is.True);
- Assert.That(entityManager.TryGetComponent(device1, out wiredNetworkComponent), Is.True);
- Assert.That(networkComponent1.ReceiveFrequency != null, Is.True);
- Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty));
+ Assert.Multiple(() =>
+ {
+ Assert.That(entityManager.TryGetComponent(device1, out networkComponent1), Is.True);
+ Assert.That(entityManager.TryGetComponent(device1, out wiredNetworkComponent), Is.True);
+ });
+ Assert.Multiple(() =>
+ {
+ Assert.That(networkComponent1.ReceiveFrequency, Is.Not.Null);
+ Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty));
+ });
device2 = entityManager.SpawnEntity("DummyWiredNetworkDevice", coordinates);
Assert.That(entityManager.TryGetComponent(device2, out networkComponent2), Is.True);
- Assert.That(networkComponent2.ReceiveFrequency != null, Is.True);
- Assert.That(networkComponent2.Address, Is.Not.EqualTo(string.Empty));
+ Assert.Multiple(() =>
+ {
+ Assert.That(networkComponent2.ReceiveFrequency, Is.Not.Null);
+ Assert.That(networkComponent2.Address, Is.Not.EqualTo(string.Empty));
- Assert.That(networkComponent1.Address, Is.Not.EqualTo(networkComponent2.Address));
+ Assert.That(networkComponent1.Address, Is.Not.EqualTo(networkComponent2.Address));
+ });
deviceNetSystem.QueuePacket(device1, networkComponent2.Address, payload, networkComponent2.ReceiveFrequency.Value);
});
@@ -225,7 +266,8 @@ await server.WaitAssertion(() => {
await server.WaitRunTicks(1);
await server.WaitIdleAsync();
- await server.WaitAssertion(() => {
+ await server.WaitAssertion(() =>
+ {
//CollectionAssert.AreNotEqual(deviceNetTestSystem.LastPayload, payload);
entityManager.SpawnEntity("CableApcExtension", coordinates);
@@ -236,7 +278,8 @@ await server.WaitAssertion(() => {
await server.WaitRunTicks(1);
await server.WaitIdleAsync();
- await server.WaitAssertion(() => {
+ await server.WaitAssertion(() =>
+ {
CollectionAssert.AreEqual(deviceNetTestSystem.LastPayload, payload);
});
diff --git a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs
index cd7da1fbd27..948252e5cc4 100644
--- a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs
+++ b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs
@@ -1,6 +1,5 @@
#nullable enable annotations
using System.Linq;
-using System.Threading.Tasks;
using Content.Server.Disposal.Tube.Components;
using Content.Server.Disposal.Unit.Components;
using Content.Server.Disposal.Unit.EntitySystems;
diff --git a/Content.IntegrationTests/Tests/DoAfter/DoAfterCancellationTests.cs b/Content.IntegrationTests/Tests/DoAfter/DoAfterCancellationTests.cs
index d52a3d94979..29cb6426c94 100644
--- a/Content.IntegrationTests/Tests/DoAfter/DoAfterCancellationTests.cs
+++ b/Content.IntegrationTests/Tests/DoAfter/DoAfterCancellationTests.cs
@@ -1,10 +1,8 @@
using System.Linq;
-using System.Threading.Tasks;
using Content.IntegrationTests.Tests.Construction.Interaction;
using Content.IntegrationTests.Tests.Interaction;
using Content.IntegrationTests.Tests.Weldable;
using Content.Server.Tools.Components;
-using NUnit.Framework;
namespace Content.IntegrationTests.Tests.DoAfter;
@@ -18,7 +16,7 @@ public sealed class DoAfterCancellationTests : InteractionTest
public async Task CancelWallDeconstruct()
{
await StartDeconstruction(WallConstruction.WallSolid);
- await Interact(Weld, awaitDoAfters:false);
+ await Interact(Weld, awaitDoAfters: false);
// Failed do-after has no effect
await CancelDoAfters();
@@ -30,7 +28,7 @@ public async Task CancelWallDeconstruct()
// Repeat for wrenching interaction
AssertAnchored();
- await Interact(Wrench, awaitDoAfters:false);
+ await Interact(Wrench, awaitDoAfters: false);
await CancelDoAfters();
AssertAnchored();
AssertPrototype(WallConstruction.Girder);
@@ -39,7 +37,7 @@ public async Task CancelWallDeconstruct()
// Repeat for screwdriver interaction.
AssertDeleted(false);
- await Interact(Screw, awaitDoAfters:false);
+ await Interact(Screw, awaitDoAfters: false);
await CancelDoAfters();
AssertDeleted(false);
await Interact(Screw);
@@ -50,13 +48,13 @@ public async Task CancelWallDeconstruct()
public async Task CancelWallConstruct()
{
await StartConstruction(WallConstruction.Wall);
- await Interact(Steel, 5, awaitDoAfters:false);
+ await Interact(Steel, 5, awaitDoAfters: false);
await CancelDoAfters();
Assert.That(Target.HasValue && Target.Value.IsClientSide());
await Interact(Steel, 5);
AssertPrototype(WallConstruction.Girder);
- await Interact(Steel, 5, awaitDoAfters:false);
+ await Interact(Steel, 5, awaitDoAfters: false);
await CancelDoAfters();
AssertPrototype(WallConstruction.Girder);
@@ -68,7 +66,7 @@ public async Task CancelWallConstruct()
public async Task CancelTilePry()
{
await SetTile(Floor);
- await Interact(Pry, awaitDoAfters:false);
+ await Interact(Pry, awaitDoAfters: false);
await CancelDoAfters();
await AssertTile(Floor);
@@ -80,7 +78,7 @@ public async Task CancelTilePry()
public async Task CancelRepeatedTilePry()
{
await SetTile(Floor);
- await Interact(Pry, awaitDoAfters:false);
+ await Interact(Pry, awaitDoAfters: false);
await RunTicks(1);
Assert.That(ActiveDoAfters.Count(), Is.EqualTo(1));
await AssertTile(Floor);
@@ -102,35 +100,56 @@ public async Task CancelRepeatedWeld()
await SpawnTarget(WeldableTests.Locker);
var comp = Comp();
- Assert.That(comp.Weldable, Is.True);
- Assert.That(comp.IsWelded, Is.False);
+ Assert.Multiple(() =>
+ {
+ Assert.That(comp.Weldable, Is.True);
+ Assert.That(comp.IsWelded, Is.False);
+ });
- await Interact(Weld, awaitDoAfters:false);
+ await Interact(Weld, awaitDoAfters: false);
await RunTicks(1);
- Assert.That(ActiveDoAfters.Count(), Is.EqualTo(1));
- Assert.That(comp.IsWelded, Is.False);
+ Assert.Multiple(() =>
+ {
+ Assert.That(ActiveDoAfters.Count(), Is.EqualTo(1));
+ Assert.That(comp.IsWelded, Is.False);
+ });
// Second DoAfter cancels the first.
// Not using helper, because it runs too many ticks & causes the do-after to finish.
await Server.WaitPost(() => InteractSys.UserInteraction(Player, TargetCoords, Target));
- Assert.That(ActiveDoAfters.Count(), Is.EqualTo(0));
- Assert.That(comp.IsWelded, Is.False);
+ Assert.Multiple(() =>
+ {
+ Assert.That(ActiveDoAfters.Count(), Is.EqualTo(0));
+ Assert.That(comp.IsWelded, Is.False);
+ });
// Third do after will work fine
await Interact(Weld);
- Assert.That(ActiveDoAfters.Count(), Is.EqualTo(0));
- Assert.That(comp.IsWelded, Is.True);
+ Assert.Multiple(() =>
+ {
+ Assert.That(ActiveDoAfters.Count(), Is.EqualTo(0));
+ Assert.That(comp.IsWelded, Is.True);
+ });
// Repeat test for un-welding
- await Interact(Weld, awaitDoAfters:false);
+ await Interact(Weld, awaitDoAfters: false);
await RunTicks(1);
- Assert.That(ActiveDoAfters.Count(), Is.EqualTo(1));
- Assert.That(comp.IsWelded, Is.True);
+ Assert.Multiple(() =>
+ {
+ Assert.That(ActiveDoAfters.Count(), Is.EqualTo(1));
+ Assert.That(comp.IsWelded, Is.True);
+ });
await Server.WaitPost(() => InteractSys.UserInteraction(Player, TargetCoords, Target));
- Assert.That(ActiveDoAfters.Count(), Is.EqualTo(0));
- Assert.That(comp.IsWelded, Is.True);
+ Assert.Multiple(() =>
+ {
+ Assert.That(ActiveDoAfters.Count(), Is.EqualTo(0));
+ Assert.That(comp.IsWelded, Is.True);
+ });
await Interact(Weld);
- Assert.That(ActiveDoAfters.Count(), Is.EqualTo(0));
- Assert.That(comp.IsWelded, Is.False);
+ Assert.Multiple(() =>
+ {
+ Assert.That(ActiveDoAfters.Count(), Is.EqualTo(0));
+ Assert.That(comp.IsWelded, Is.False);
+ });
}
}
diff --git a/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs b/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs
index 390bdff8d3a..efcf12e3dba 100644
--- a/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs
+++ b/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs
@@ -1,9 +1,5 @@
-using System;
-using System.Threading.Tasks;
using Content.Shared.DoAfter;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Reflection;
using Robust.Shared.Serialization;
@@ -35,7 +31,7 @@ public override DoAfterEvent Clone()
[Test]
public async Task TestSerializable()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
await server.WaitIdleAsync();
var refMan = server.ResolveDependency();
@@ -62,7 +58,11 @@ await server.WaitPost(() =>
[Test]
public async Task TestFinished()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
await server.WaitIdleAsync();
@@ -77,8 +77,10 @@ await server.WaitPost(() =>
var tickTime = 1.0f / timing.TickRate;
var mob = entityManager.SpawnEntity("Dummy", MapCoordinates.Nullspace);
var args = new DoAfterArgs(mob, tickTime / 2, ev, null) { Broadcast = true };
+#pragma warning disable NUnit2045 // Interdependent assertions.
Assert.That(doAfterSystem.TryStartDoAfter(args));
Assert.That(ev.Cancelled, Is.False);
+#pragma warning restore NUnit2045
});
await server.WaitRunTicks(1);
@@ -90,12 +92,15 @@ await server.WaitPost(() =>
[Test]
public async Task TestCancelled()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var entityManager = server.ResolveDependency();
var timing = server.ResolveDependency();
var doAfterSystem = entityManager.EntitySysManager.GetEntitySystem();
- DoAfterId? id;
var ev = new TestDoAfterEvent();
await server.WaitPost(() =>
@@ -105,7 +110,7 @@ await server.WaitPost(() =>
var mob = entityManager.SpawnEntity("Dummy", MapCoordinates.Nullspace);
var args = new DoAfterArgs(mob, tickTime * 2, ev, null) { Broadcast = true };
- if (!doAfterSystem.TryStartDoAfter(args, out id))
+ if (!doAfterSystem.TryStartDoAfter(args, out var id))
{
Assert.Fail();
return;
diff --git a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs
index b61eaf46218..b856169d99c 100644
--- a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs
+++ b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs
@@ -1,12 +1,8 @@
-using System;
-using System.Threading.Tasks;
using Content.Server.Doors.Systems;
using Content.Shared.Doors.Components;
-using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;
-using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
@@ -55,7 +51,11 @@ public sealed class AirlockTest
[Test]
public async Task OpenCloseDestroyTest()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
var entityManager = server.ResolveDependency();
@@ -68,8 +68,10 @@ await server.WaitAssertion(() =>
{
airlock = entityManager.SpawnEntity("AirlockDummy", MapCoordinates.Nullspace);
- Assert.True(entityManager.TryGetComponent(airlock, out doorComponent));
+#pragma warning disable NUnit2045 // Interdependent assertions.
+ Assert.That(entityManager.TryGetComponent(airlock, out doorComponent), Is.True);
Assert.That(doorComponent.State, Is.EqualTo(DoorState.Closed));
+#pragma warning restore NUnit2045
});
await server.WaitIdleAsync();
@@ -112,7 +114,11 @@ await server.WaitAssertion(() =>
[Test]
public async Task AirlockBlockTest()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
+ {
+ NoClient = true,
+ ExtraPrototypes = Prototypes
+ });
var server = pairTracker.Pair.Server;
await server.WaitIdleAsync();
@@ -120,6 +126,7 @@ public async Task AirlockBlockTest()
var mapManager = server.ResolveDependency();
var entityManager = server.ResolveDependency();
var physicsSystem = entityManager.System();
+ var xformSystem = entityManager.System();
PhysicsComponent physBody = null;
EntityUid physicsDummy = default;
@@ -137,9 +144,11 @@ await server.WaitAssertion(() =>
airlock = entityManager.SpawnEntity("AirlockDummy", new MapCoordinates((0, 0), mapId));
- Assert.True(entityManager.TryGetComponent(physicsDummy, out physBody));
-
- Assert.True(entityManager.TryGetComponent(airlock, out doorComponent));
+ Assert.Multiple(() =>
+ {
+ Assert.That(entityManager.TryGetComponent(physicsDummy, out physBody), Is.True);
+ Assert.That(entityManager.TryGetComponent(airlock, out doorComponent), Is.True);
+ });
Assert.That(doorComponent.State, Is.EqualTo(DoorState.Closed));
});
@@ -171,7 +180,10 @@ await server.WaitPost(() =>
// Assert.That(physicsDummy.Transform.MapPosition.X, Is.GreaterThan(physicsDummyStartingX));
// Blocked by the airlock
- await server.WaitAssertion(() => Assert.That(Math.Abs(entityManager.GetComponent(physicsDummy).MapPosition.X - 1) > 0.01f));
+ await server.WaitAssertion(() =>
+ {
+ Assert.That(Math.Abs(xformSystem.GetWorldPosition(physicsDummy).X - 1), Is.GreaterThan(0.01f));
+ });
await pairTracker.CleanReturnAsync();
}
}
diff --git a/Content.IntegrationTests/Tests/DummyIconTest.cs b/Content.IntegrationTests/Tests/DummyIconTest.cs
index d51da122d44..56a183a42cd 100644
--- a/Content.IntegrationTests/Tests/DummyIconTest.cs
+++ b/Content.IntegrationTests/Tests/DummyIconTest.cs
@@ -1,10 +1,7 @@
#nullable enable
using System.Linq;
-using System.Threading.Tasks;
-using NUnit.Framework;
using Robust.Client.GameObjects;
using Robust.Client.ResourceManagement;
-using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
namespace Content.IntegrationTests.Tests
diff --git a/Content.IntegrationTests/Tests/EncryptionKeys/RemoveEncryptionKeys.cs b/Content.IntegrationTests/Tests/EncryptionKeys/RemoveEncryptionKeys.cs
index f25564a4fcc..742a968d2d0 100644
--- a/Content.IntegrationTests/Tests/EncryptionKeys/RemoveEncryptionKeys.cs
+++ b/Content.IntegrationTests/Tests/EncryptionKeys/RemoveEncryptionKeys.cs
@@ -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 async Task HeadsetKeys()
await SpawnTarget("ClothingHeadsetGrey");
var comp = Comp();
- 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 async Task CommsServerKeys()
var comp = Comp();
var panel = Comp();
- 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 async Task CommsServerKeys()
AssertPrototype("MachineFrame");
}
}
-
diff --git a/Content.IntegrationTests/Tests/EntityTest.cs b/Content.IntegrationTests/Tests/EntityTest.cs
index 50ab2eb400f..2516decf725 100644
--- a/Content.IntegrationTests/Tests/EntityTest.cs
+++ b/Content.IntegrationTests/Tests/EntityTest.cs
@@ -1,14 +1,9 @@
-using System;
using System.Collections.Generic;
using System.Linq;
-using System.Threading.Tasks;
-using Content.Shared.CCVar;
using Content.Shared.Coordinates;
-using NUnit.Framework;
using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
@@ -24,7 +19,7 @@ public sealed class EntityTest
[Test]
public async Task SpawnAndDeleteAllEntitiesOnDifferentMaps()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, Destructive = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true, Destructive = true });
var server = pairTracker.Pair.Server;
var entityMan = server.ResolveDependency();
@@ -35,7 +30,7 @@ await server.WaitPost(() =>
{
var protoIds = prototypeMan
.EnumeratePrototypes()
- .Where(p=>!p.Abstract)
+ .Where(p => !p.Abstract)
.Where(p => !p.Components.ContainsKey("MapGrid")) // This will smash stuff otherwise.
.Select(p => p.ID)
.ToList();
@@ -52,11 +47,19 @@ await server.WaitPost(() =>
await server.WaitPost(() =>
{
- var entityMetas = entityMan.EntityQuery(true).ToList();
- foreach (var meta in entityMetas)
+ static IEnumerable<(EntityUid, TComp)> Query(IEntityManager entityMan)
+ where TComp : Component
{
- if(!meta.EntityDeleted)
- entityMan.DeleteEntity(meta.Owner);
+ var query = entityMan.AllEntityQueryEnumerator();
+ while (query.MoveNext(out var uid, out var meta))
+ yield return (uid, meta);
+ };
+
+ var entityMetas = Query(entityMan).ToList();
+ foreach (var (uid, meta) in entityMetas)
+ {
+ if (!meta.EntityDeleted)
+ entityMan.DeleteEntity(uid);
}
Assert.That(entityMan.EntityCount, Is.Zero);
@@ -68,7 +71,7 @@ await server.WaitPost(() =>
[Test]
public async Task SpawnAndDeleteAllEntitiesInTheSameSpot()
{
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, Destructive = true});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true, Destructive = true });
var server = pairTracker.Pair.Server;
var map = await PoolManager.CreateTestMap(pairTracker);
@@ -80,7 +83,7 @@ await server.WaitPost(() =>
var protoIds = prototypeMan
.EnumeratePrototypes()
- .Where(p=>!p.Abstract)
+ .Where(p => !p.Abstract)
.Where(p => !p.Components.ContainsKey("MapGrid")) // This will smash stuff otherwise.
.Select(p => p.ID)
.ToList();
@@ -92,11 +95,19 @@ await server.WaitPost(() =>
await server.WaitRunTicks(15);
await server.WaitPost(() =>
{
- var entityMetas = entityMan.EntityQuery(true).ToList();
- foreach (var meta in entityMetas)
+ static IEnumerable<(EntityUid, TComp)> Query(IEntityManager entityMan)
+ where TComp : Component
+ {
+ var query = entityMan.AllEntityQueryEnumerator();
+ while (query.MoveNext(out var uid, out var meta))
+ yield return (uid, meta);
+ };
+
+ var entityMetas = Query(entityMan).ToList();
+ foreach (var (uid, meta) in entityMetas)
{
- if(!meta.EntityDeleted)
- entityMan.DeleteEntity(meta.Owner);
+ if (!meta.EntityDeleted)
+ entityMan.DeleteEntity(uid);
}
Assert.That(entityMan.EntityCount, Is.Zero);
@@ -132,7 +143,7 @@ public async Task SpawnAndDirtyAllEntities()
// for whatever reason, stealth boxes are breaking this test. Surplus crates have a chance of spawning them.
// TODO fix whatever is going wrong here.
- HashSet ignored = new() {"GhostBox", "StealthBox", "CrateSyndicateSurplusBundle", "CrateSyndicateSuperSurplusBundle"};
+ HashSet ignored = new() { "GhostBox", "StealthBox", "CrateSyndicateSurplusBundle", "CrateSyndicateSuperSurplusBundle" };
await server.WaitPost(() =>
{
@@ -159,11 +170,19 @@ await server.WaitPost(() =>
await server.WaitPost(() =>
{
- var entityMetas = sEntMan.EntityQuery(true).ToList();
- foreach (var meta in entityMetas)
+ static IEnumerable<(EntityUid, TComp)> Query(IEntityManager entityMan)
+ where TComp : Component
+ {
+ var query = entityMan.AllEntityQueryEnumerator();
+ while (query.MoveNext(out var uid, out var meta))
+ yield return (uid, meta);
+ };
+
+ var entityMetas = Query(sEntMan).ToList();
+ foreach (var (uid, meta) in entityMetas)
{
if (!meta.EntityDeleted)
- sEntMan.DeleteEntity(meta.Owner);
+ sEntMan.DeleteEntity(uid);
}
Assert.That(sEntMan.EntityCount, Is.Zero);
@@ -196,13 +215,14 @@ public async Task AllComponentsOneToOneDeleteTest()
- type: entity
id: AllComponentsOneToOneDeleteTestEntity";
- await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = testEntity});
+ await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true, ExtraPrototypes = testEntity });
var server = pairTracker.Pair.Server;
var mapManager = server.ResolveDependency();
var entityManager = server.ResolveDependency();
var componentFactory = server.ResolveDependency();
var tileDefinitionManager = server.ResolveDependency