Delta-v/Content.IntegrationTests/Tests/Humanoid/HumanoidProfileTests.cs

49 lines
1.8 KiB
C#

using Content.IntegrationTests.Fixtures;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Preferences;
using Content.Shared.Speech.Components;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;
namespace Content.IntegrationTests.Tests.Humanoid;
[TestFixture]
[TestOf(typeof(HumanoidProfileSystem))]
public sealed class HumanoidProfileTests : GameTest
{
private static readonly ProtoId<SpeciesPrototype> Vox = "Vox";
[Test]
public async Task EnsureValidLoading()
{
var pair = Pair;
var server = pair.Server;
await server.WaitIdleAsync();
await server.WaitAssertion(() =>
{
var entityManager = server.ResolveDependency<IEntityManager>();
var humanoidProfile = entityManager.System<HumanoidProfileSystem>();
var human = entityManager.Spawn("MobHuman");
humanoidProfile.ApplyProfileTo(human, new HumanoidCharacterProfile()
.WithSex(Sex.Female)
.WithAge(67)
.WithGender(Gender.Neuter)
.WithSpecies(Vox));
var humanoidComponent = entityManager.GetComponent<HumanoidProfileComponent>(human);
var voiceComponent = entityManager.GetComponent<VocalComponent>(human);
Assert.That(humanoidComponent.Age, Is.EqualTo(67));
Assert.That(humanoidComponent.Sex, Is.EqualTo(Sex.Female));
Assert.That(humanoidComponent.Gender, Is.EqualTo(Gender.Neuter));
Assert.That(humanoidComponent.Species, Is.EqualTo(Vox));
Assert.That(voiceComponent.Sounds, Is.Not.Null, message: "the MobHuman spawned by this test needs to have sex-specific sound set");
Assert.That(voiceComponent.Sounds![Sex.Female], Is.EqualTo(voiceComponent.EmoteSounds));
});
}
}