Fix content.integration tests warnings (#17817)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
TemporalOroboros
2023-07-05 21:54:25 -07:00
committed by GitHub
parent 20c1754abd
commit ba91023a85
121 changed files with 3658 additions and 1961 deletions

View File

@@ -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 @@ namespace Content.IntegrationTests.Tests.Atmos
[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<IPrototypeManager>();
@@ -39,8 +37,11 @@ namespace Content.IntegrationTests.Tests.Atmos
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 @@ namespace Content.IntegrationTests.Tests.Atmos
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));

View File

@@ -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 @@ namespace Content.IntegrationTests.Tests.Atmos
[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<IEntityManager>();
await server.WaitPost(() =>
{
var atmosSystem = EntitySystem.Get<AtmosphereSystem>();
var atmosSystem = entityManager.System<AtmosphereSystem>();
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();
}

View File

@@ -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 @@ namespace Content.IntegrationTests.Tests.Atmos
[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<IEntitySystemManager>().GetEntitySystem<AtmosphereSystem>();
@@ -28,23 +26,35 @@ namespace Content.IntegrationTests.Tests.Atmos
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 @@ namespace Content.IntegrationTests.Tests.Atmos
[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 @@ namespace Content.IntegrationTests.Tests.Atmos
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.Multiple(() =>
{
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.Multiple(() =>
{
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(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();