From 14cd55e765ff7584d72079500660bf491aa70fba Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Mon, 17 Jun 2024 03:46:59 +1200 Subject: [PATCH] Remove ServerAlertsComponentTests (#29027) --- .../Alert/ServerAlertsComponentTests.cs | 83 ------------------- 1 file changed, 83 deletions(-) delete mode 100644 Content.Tests/Shared/Alert/ServerAlertsComponentTests.cs diff --git a/Content.Tests/Shared/Alert/ServerAlertsComponentTests.cs b/Content.Tests/Shared/Alert/ServerAlertsComponentTests.cs deleted file mode 100644 index bcc32e13dee..00000000000 --- a/Content.Tests/Shared/Alert/ServerAlertsComponentTests.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System.IO; -using Content.Server.Alert; -using Content.Shared.Alert; -using NUnit.Framework; -using Robust.Shared.GameObjects; -using Robust.Shared.GameStates; -using Robust.Shared.IoC; -using Robust.Shared.Prototypes; -using Robust.Shared.Serialization.Manager; - -namespace Content.Tests.Shared.Alert -{ - [TestFixture] - [TestOf(typeof(AlertsComponent))] - public sealed class ServerAlertsComponentTests : ContentUnitTest - { - const string PROTOTYPES = @" -- type: alertCategory - id: Pressure - -- type: alert - id: LowPressure - category: Pressure - icon: /Textures/Interface/Alerts/Pressure/lowpressure.png - -- type: alert - id: HighPressure - category: Pressure - icon: /Textures/Interface/Alerts/Pressure/highpressure.png -"; - - [Test] - [Ignore("There is no way to load extra Systems in a unit test, fixing RobustUnitTest is out of scope.")] - public void ShowAlerts() - { - // this is kind of unnecessary because there's integration test coverage of Alert components - // but wanted to keep it anyway to see what's possible w.r.t. testing components - // in a unit test - - var entManager = IoCManager.Resolve(); - IoCManager.Resolve().Initialize(); - var prototypeManager = IoCManager.Resolve(); - prototypeManager.Initialize(); - var factory = IoCManager.Resolve(); - factory.RegisterClass(); - prototypeManager.LoadFromStream(new StringReader(PROTOTYPES)); - prototypeManager.ResolveResults(); - - var entSys = entManager.EntitySysManager; - entSys.LoadExtraSystemType(); - - var alertsComponent = new AlertsComponent(); - alertsComponent = IoCManager.InjectDependencies(alertsComponent); - - Assert.That(entManager.System().TryGet("LowPressure", out var lowpressure)); - Assert.That(entManager.System().TryGet("HighPressure", out var highpressure)); - - entManager.System().ShowAlert(alertsComponent.Owner, "LowPressure"); - - var getty = new ComponentGetState(); - entManager.EventBus.RaiseComponentEvent(alertsComponent, getty); - - var alertState = (AlertsComponent.AlertsComponent_AutoState) getty.State!; - Assert.That(alertState, Is.Not.Null); - Assert.That(alertState.Alerts.Count, Is.EqualTo(1)); - Assert.That(alertState.Alerts.ContainsKey(lowpressure!.AlertKey)); - - entManager.System().ShowAlert(alertsComponent.Owner, "HighPressure"); - - // Lazy - entManager.EventBus.RaiseComponentEvent(alertsComponent, getty); - alertState = (AlertsComponent.AlertsComponent_AutoState) getty.State!; - Assert.That(alertState.Alerts.Count, Is.EqualTo(1)); - Assert.That(alertState.Alerts.ContainsKey(highpressure!.AlertKey)); - - entManager.System().ClearAlertCategory(alertsComponent.Owner, "Pressure"); - - entManager.EventBus.RaiseComponentEvent(alertsComponent, getty); - alertState = (AlertsComponent.AlertsComponent_AutoState) getty.State!; - Assert.That(alertState.Alerts.Count, Is.EqualTo(0)); - } - } -}