@@ -1,4 +1,6 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Content.Client.Alerts;
|
||||||
|
using Content.Server.Alert;
|
||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -7,11 +9,12 @@ using Robust.Shared.Prototypes;
|
|||||||
using Robust.Shared.Reflection;
|
using Robust.Shared.Reflection;
|
||||||
using Robust.Shared.Serialization.Manager;
|
using Robust.Shared.Serialization.Manager;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
using Robust.UnitTesting;
|
||||||
|
|
||||||
namespace Content.Tests.Shared.Alert
|
namespace Content.Tests.Shared.Alert
|
||||||
{
|
{
|
||||||
[TestFixture, TestOf(typeof(AlertsSystem))]
|
[TestFixture, TestOf(typeof(AlertsSystem))]
|
||||||
public sealed class AlertManagerTests : ContentUnitTest
|
public sealed class AlertManagerTests : RobustUnitTest
|
||||||
{
|
{
|
||||||
const string PROTOTYPES = @"
|
const string PROTOTYPES = @"
|
||||||
- type: alert
|
- type: alert
|
||||||
@@ -29,6 +32,10 @@ namespace Content.Tests.Shared.Alert
|
|||||||
[Ignore("There is no way to load extra Systems in a unit test, fixing RobustUnitTest is out of scope.")]
|
[Ignore("There is no way to load extra Systems in a unit test, fixing RobustUnitTest is out of scope.")]
|
||||||
public void TestAlertManager()
|
public void TestAlertManager()
|
||||||
{
|
{
|
||||||
|
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
var sysManager = entManager.EntitySysManager;
|
||||||
|
sysManager.LoadExtraSystemType<ClientAlertsSystem>();
|
||||||
|
var alertsSystem = sysManager.GetEntitySystem<ClientAlertsSystem>();
|
||||||
IoCManager.Resolve<ISerializationManager>().Initialize();
|
IoCManager.Resolve<ISerializationManager>().Initialize();
|
||||||
|
|
||||||
var reflection = IoCManager.Resolve<IReflectionManager>();
|
var reflection = IoCManager.Resolve<IReflectionManager>();
|
||||||
@@ -38,14 +45,14 @@ namespace Content.Tests.Shared.Alert
|
|||||||
prototypeManager.Initialize();
|
prototypeManager.Initialize();
|
||||||
prototypeManager.LoadFromStream(new StringReader(PROTOTYPES));
|
prototypeManager.LoadFromStream(new StringReader(PROTOTYPES));
|
||||||
|
|
||||||
Assert.That(EntitySystem.Get<AlertsSystem>().TryGet(AlertType.LowPressure, out var lowPressure));
|
Assert.That(alertsSystem.TryGet(AlertType.LowPressure, out var lowPressure));
|
||||||
Assert.That(lowPressure.Icons[0], Is.EqualTo(new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/Alerts/Pressure/lowpressure.png"))));
|
Assert.That(lowPressure.Icons[0], Is.EqualTo(new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/Alerts/Pressure/lowpressure.png"))));
|
||||||
Assert.That(EntitySystem.Get<AlertsSystem>().TryGet(AlertType.HighPressure, out var highPressure));
|
Assert.That(alertsSystem.TryGet(AlertType.HighPressure, out var highPressure));
|
||||||
Assert.That(highPressure.Icons[0], Is.EqualTo(new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/Alerts/Pressure/highpressure.png"))));
|
Assert.That(highPressure.Icons[0], Is.EqualTo(new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/Alerts/Pressure/highpressure.png"))));
|
||||||
|
|
||||||
Assert.That(EntitySystem.Get<AlertsSystem>().TryGet(AlertType.LowPressure, out lowPressure));
|
Assert.That(alertsSystem.TryGet(AlertType.LowPressure, out lowPressure));
|
||||||
Assert.That(lowPressure.Icons[0], Is.EqualTo(new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/Alerts/Pressure/lowpressure.png"))));
|
Assert.That(lowPressure.Icons[0], Is.EqualTo(new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/Alerts/Pressure/lowpressure.png"))));
|
||||||
Assert.That(EntitySystem.Get<AlertsSystem>().TryGet(AlertType.HighPressure, out highPressure));
|
Assert.That(alertsSystem.TryGet(AlertType.HighPressure, out highPressure));
|
||||||
Assert.That(highPressure.Icons[0], Is.EqualTo(new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/Alerts/Pressure/highpressure.png"))));
|
Assert.That(highPressure.Icons[0], Is.EqualTo(new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/Alerts/Pressure/highpressure.png"))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user