CatStation/Content.IntegrationTests/Tests/GameTestTests/DependencyTests.cs
Princess Cheeseballs 2c6ffecf62
Move GameTicker to Shared (#45834)
* Scope creep my ass

* why was this shit not pushed????

* gone...

* fix that

* review plus buildd

* asfsafsafsafsafas

* grug

* burber

* I'll fix this later

* shrimply die

* also this

* it's snerf or snuthin

* assaads

* round snend

* aaaa

* fix this shit for real

* actually, don't start GameRules until MapInit now that I think aboot it.

* forgot u

* don't actually need this part nullable

* Deffer comp removal

* one liner

* do that too

* chungus

* Honestly makes more sense here, plus WHY are we doing all that shit on "GameRuleAdded" rather than GameRuleStarted(?)

* deferred removal :V

* aaaaaaaaaaaaaaa

* whhop

* Whoop

* better

* landmine that I placed for myself then forgot about lmao

* cleanup

* FUCKING `!`

* gotovo

* amogus

* please don't check by metadata I beg

* waawsasfdfsasfa

* sfafsasfafsas

* fdsaasffsasfa

* code

* fix

* fasasffasfasfsad

* chungaas

* I may be stupid

* gra

* graaaaaaaaaaaaaaaaa

* comment

* gra

* clearing is not predicted and would require major refactors, so don't cache on client.

* lame shit :P

* last holes

* nukeopsfsafsasafsfafsa

* why  was that shit public bruh

* bubrbgwahrghfaka

* dynamic

* revert change that did nothing lmao
2026-09-16 19:34:19 +00:00

53 lines
2 KiB
C#

#nullable enable
using System.Collections.Generic;
using Content.Client.GameTicking;
using Content.IntegrationTests.Fixtures;
using Content.IntegrationTests.Fixtures.Attributes;
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 GameTicker _sGameTicker = null!;
[SidedDependency(Side.Client)] private readonly GameTicker _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<ServerGameTicker>());
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);
}
}