mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-01 16:47:26 +00:00
* Ports much of GameTest, minus all the WIP stuff. * remark. * EnsureCVar now adds test properties. * Some cleanup and functionality. * Ignore broken test. Needs fixed eventually. Also explicit context config. * TrackingIssue attribute. * oops * Pair config attribute. * Remove SystemAttribute in favor of using the EntitySystemManager dependency collection. * Ensure idleness. * More tests for tests. * More specific failure catching tests. * Reverse attribute resolution order so suite-wide attributes happen first. * Get rid of AffectedProperties again because I need to refactor PoolSettings for that. * Poke * Final cleanup pass. * Update Content.IntegrationTests/Fixtures/Attributes/RunOnSideAttribute.cs Co-authored-by: Tayrtahn <tayrtahn@gmail.com> * Update Content.IntegrationTests/Fixtures/Attributes/Side.cs Co-authored-by: Tayrtahn <tayrtahn@gmail.com> * Update Content.IntegrationTests/NUnit/Utilities/ITestExtensions.cs Co-authored-by: Tayrtahn <tayrtahn@gmail.com> * Fixes. * shut up nunit. * Make TrackingIssue a bit strict on purpose, so people don't put junk here. * Update Content.IntegrationTests/Tests/GameTestTests/DisconnectedDependencyTest.cs Co-authored-by: Tayrtahn <tayrtahn@gmail.com> * Address. --------- Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
55 lines
2.0 KiB
C#
55 lines
2.0 KiB
C#
#nullable enable
|
|
using System.Collections.Generic;
|
|
using Content.Client.GameTicking.Managers;
|
|
using Content.IntegrationTests.Fixtures;
|
|
using Content.IntegrationTests.Fixtures.Attributes;
|
|
using Content.IntegrationTests.NUnit.Constraints;
|
|
using Content.Server.GameTicking;
|
|
using Content.Shared.GameTicking;
|
|
using Robust.Shared.GameObjects;
|
|
|
|
namespace Content.IntegrationTests.Tests.GameTestTests;
|
|
|
|
[TestOf(typeof(GameTest))]
|
|
[TestOf(typeof(SidedDependencyAttribute))]
|
|
public sealed class DependencyTests : GameTest
|
|
{
|
|
[SidedDependency(Side.Server)] private readonly SharedGameTicker _sGameTicker = null!;
|
|
[SidedDependency(Side.Client)] private readonly SharedGameTicker _cGameTicker = null!;
|
|
[SidedDependency(Side.Server)] private readonly EntityQuery<TransformComponent> _sXformQuery = default!;
|
|
|
|
[Test]
|
|
[Description("Asserts that sided dependencies actually grab from the right sides.")]
|
|
public void DependenciesRespectSides()
|
|
{
|
|
using (Assert.EnterMultipleScope())
|
|
{
|
|
Assert.That(!ReferenceEquals(SEntMan, CEntMan), "Server and client entity managers should be distinct");
|
|
Assert.That(SEntMan, Is.EqualTo(Server.EntMan).Using<object?>(ReferenceEqualityComparer.Instance));
|
|
Assert.That(CEntMan, Is.EqualTo(Client.EntMan).Using<object?>(ReferenceEqualityComparer.Instance));
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
[Description("Asserts that system dependencies actually grab from the right sides.")]
|
|
public void SystemDependenciesRespectSides()
|
|
{
|
|
using (Assert.EnterMultipleScope())
|
|
{
|
|
Assert.That(!ReferenceEquals(_sGameTicker, _cGameTicker),
|
|
"Server and client gametickers should be distinct");
|
|
Assert.That(_sGameTicker, Is.TypeOf<GameTicker>());
|
|
Assert.That(_cGameTicker, Is.TypeOf<ClientGameTicker>());
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
[Description("Asserts that query dependencies function")]
|
|
public async Task QueryDependencies()
|
|
{
|
|
var ent = await Spawn(null);
|
|
|
|
Assert.That(_sXformQuery.HasComp(ent), Is.True);
|
|
}
|
|
}
|