fix: Fixes flaky tests, formatting, and sequential testing. (#2168)

This commit is contained in:
Kamron Batman 2025-04-30 16:42:38 -07:00 • committed by GitHub
parent 415c7a6bfd
commit 7dbfc9d161
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
60 changed files with 1304 additions and 1289 deletions

View file

@ -7,50 +7,50 @@ using Xunit;
namespace UOContent.Tests;
[Collection("Sequential Tests")]
public class CorpsePacketTests : IClassFixture<ServerFixture>
[Collection("Sequential UOContent Tests")]
public class CorpsePacketTests
{
[Fact]
public void TestCorpseEquipPacket()
{
var m = new Mobile((Serial)0x1);
m.DefaultMobileInit();
var m = new Mobile((Serial)0x1);
m.DefaultMobileInit();
var weapon = new VikingSword();
m.EquipItem(weapon);
var weapon = new VikingSword();
m.EquipItem(weapon);
var c = new Corpse(m, m.Items);
var c = new Corpse(m, m.Items);
var expected = new CorpseEquip(m, c).Compile();
var expected = new CorpseEquip(m, c).Compile();
var ns = PacketTestUtilities.CreateTestNetState();
ns.SendCorpseEquip(m, c);
var ns = PacketTestUtilities.CreateTestNetState();
ns.SendCorpseEquip(m, c);
var result = ns.SendPipe.Reader.AvailableToRead();
AssertThat.Equal(result, expected);
}
}
[Theory]
[InlineData(ProtocolChanges.None)]
[InlineData(ProtocolChanges.ContainerGridLines)]
public void TestCorpseContainerPacket(ProtocolChanges changes)
{
var m = new Mobile((Serial)0x1);
m.DefaultMobileInit();
var m = new Mobile((Serial)0x1);
m.DefaultMobileInit();
var weapon = new VikingSword();
m.EquipItem(weapon);
var weapon = new VikingSword();
m.EquipItem(weapon);
var c = new Corpse(m, m.Items);
var c = new Corpse(m, m.Items);
var ns = PacketTestUtilities.CreateTestNetState();
ns.ProtocolChanges = changes;
var ns = PacketTestUtilities.CreateTestNetState();
ns.ProtocolChanges = changes;
var expected = (ns.ContainerGridLines ? (Packet)new CorpseContent6017(m, c) : new CorpseContent(m, c)).Compile();
var expected = (ns.ContainerGridLines ? (Packet)new CorpseContent6017(m, c) : new CorpseContent(m, c)).Compile();
ns.SendCorpseContent(m, c);
ns.SendCorpseContent(m, c);
var result = ns.SendPipe.Reader.AvailableToRead();
AssertThat.Equal(result, expected);
}
}
}
}