Files
tbd-station-14/Content.IntegrationTests/Tests/StationEvents/StationEventsSystemTest.cs
Acruid ca4fd649fe Massive Namespace Cleanup (#3120)
* Engine namespace changes.

* Automated remove redundant using statements.

* Simplified Graphics namespace.

* Apparently the container system stores full type names in the map file.😞 This updates those names.

* API Changes to LocalizationManager.LoadCulture.

* Update submodule to v0.3.2
2021-02-11 01:13:03 -08:00

48 lines
1.6 KiB
C#

using System.Threading.Tasks;
using Content.Server.GameObjects.EntitySystems.StationEvents;
using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Timing;
namespace Content.IntegrationTests.Tests.StationEvents
{
[TestFixture]
public class StationEventsSystemTest : ContentIntegrationTest
{
[Test]
public async Task Test()
{
var server = StartServerDummyTicker();
server.Assert(() =>
{
// Idle each event
var stationEventsSystem = EntitySystem.Get<StationEventSystem>();
var dummyFrameTime = (float) IoCManager.Resolve<IGameTiming>().TickPeriod.TotalSeconds;
foreach (var stationEvent in stationEventsSystem.StationEvents)
{
stationEvent.Announce();
stationEvent.Update(dummyFrameTime);
stationEvent.Startup();
stationEvent.Update(dummyFrameTime);
stationEvent.Running = false;
stationEvent.Shutdown();
// Due to timings some events might startup twice when in reality they wouldn't.
Assert.That(stationEvent.Occurrences > 0);
}
stationEventsSystem.Reset();
foreach (var stationEvent in stationEventsSystem.StationEvents)
{
Assert.That(stationEvent.Occurrences, Is.EqualTo(0));
}
});
await server.WaitIdleAsync();
}
}
}