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,9 +1,7 @@
using System.Linq;
using System.Threading.Tasks;
using Content.Client.UserInterface.Systems.Alerts.Controls;
using Content.Client.UserInterface.Systems.Alerts.Widgets;
using Content.Shared.Alert;
using NUnit.Framework;
using Robust.Client.UserInterface;
using Robust.Server.Player;
using Robust.Shared.GameObjects;
@@ -34,12 +32,14 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
await server.WaitAssertion(() =>
{
playerUid = serverPlayerManager.Sessions.Single().AttachedEntity.GetValueOrDefault();
Assert.That(playerUid != default);
#pragma warning disable NUnit2045 // Interdependent assertions.
Assert.That(playerUid, Is.Not.EqualTo(default));
// Making sure it exists
Assert.That(entManager.HasComponent<AlertsComponent>(playerUid));
#pragma warning restore NUnit2045
var alerts = alertsSystem.GetActiveAlerts(playerUid);
Assert.IsNotNull(alerts);
Assert.That(alerts, Is.Not.Null);
var alertCount = alerts.Count;
alertsSystem.ShowAlert(playerUid, AlertType.Debug1);
@@ -54,18 +54,20 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
await client.WaitAssertion(() =>
{
var local = clientPlayerMgr.LocalPlayer;
Assert.NotNull(local);
Assert.That(local, Is.Not.Null);
var controlled = local.ControlledEntity;
Assert.NotNull(controlled);
#pragma warning disable NUnit2045 // Interdependent assertions.
Assert.That(controlled, Is.Not.Null);
// Making sure it exists
Assert.That(clientEntManager.HasComponent<AlertsComponent>(controlled.Value));
#pragma warning restore Nunit2045
// find the alertsui
clientAlertsUI = FindAlertsUI(clientUIMgr.ActiveScreen);
Assert.NotNull(clientAlertsUI);
Assert.That(clientAlertsUI, Is.Not.Null);
AlertsUI FindAlertsUI(Control control)
static AlertsUI FindAlertsUI(Control control)
{
if (control is AlertsUI alertUI)
return alertUI;
@@ -83,7 +85,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
Assert.That(clientAlertsUI.AlertContainer.ChildCount, Is.GreaterThanOrEqualTo(3));
var alertControls = clientAlertsUI.AlertContainer.Children.Select(c => (AlertControl) c);
var alertIDs = alertControls.Select(ac => ac.Alert.AlertType).ToArray();
var expectedIDs = new [] {AlertType.HumanHealth, AlertType.Debug1, AlertType.Debug2};
var expectedIDs = new[] { AlertType.HumanHealth, AlertType.Debug1, AlertType.Debug2 };
Assert.That(alertIDs, Is.SupersetOf(expectedIDs));
});
@@ -100,7 +102,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
Assert.That(clientAlertsUI.AlertContainer.ChildCount, Is.GreaterThanOrEqualTo(2));
var alertControls = clientAlertsUI.AlertContainer.Children.Select(c => (AlertControl) c);
var alertIDs = alertControls.Select(ac => ac.Alert.AlertType).ToArray();
var expectedIDs = new [] {AlertType.HumanHealth, AlertType.Debug2};
var expectedIDs = new[] { AlertType.HumanHealth, AlertType.Debug2 };
Assert.That(alertIDs, Is.SupersetOf(expectedIDs));
});