Fixes leaking tests (#231)
This commit is contained in:
parent
6df1098e06
commit
bbdb561de8
4 changed files with 166 additions and 150 deletions
|
|
@ -9,8 +9,6 @@
|
|||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<PublicRelease>true</PublicRelease>
|
||||
<DefineConstants Condition="$(RuntimeIdentifier.StartsWith('win'))">WINDOWS</DefineConstants>
|
||||
<DefineConstants Condition="$(RuntimeIdentifier.StartsWith(`win`)) != true">UNIX</DefineConstants>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<NoWarn>NU1603</NoWarn>
|
||||
<RuntimeIdentifiers>win-x64;debian.10-x64;debian.9-x64;ubuntu.16.04-x64;ubuntu.18.04-x64;ubuntu.20.04-x64;centos.7-x64;centos.8-x64;osx-x64</RuntimeIdentifiers>
|
||||
|
|
@ -23,6 +21,10 @@
|
|||
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
|
||||
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
|
||||
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
|
||||
<DefineConstants Condition="'$(IsWindows)'=='true'">WINDOWS</DefineConstants>
|
||||
<DefineConstants Condition="'$(IsOSX)'=='true'">OSX</DefineConstants>
|
||||
<DefineConstants Condition="'$(IsLinux)'=='true'">LINUX</DefineConstants>
|
||||
<DefineConstants Condition="'$(IsOSX)'=='true' OR '$(IsLinux)'=='true'">UNIX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)'==''">
|
||||
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using Xunit;
|
|||
|
||||
namespace Server.Tests.Network.Packets
|
||||
{
|
||||
[Collection("Sequential Tests")]
|
||||
public class AttributeNormalizerTests
|
||||
{
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -106,154 +106,6 @@ namespace Server.Tests.Network.Packets
|
|||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileHits()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileHits(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[9];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0xA1); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Hits, m.HitsMax, false);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileHitsN()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileHitsN(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[9];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0xA1); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Hits, m.HitsMax, true);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileMana()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileMana(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[9];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0xA2); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Mana, m.ManaMax, false);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileManaN()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileManaN(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[9];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0xA2); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Mana, m.ManaMax, true);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileStam()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileStam(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[9];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0xA3); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Stam, m.StamMax, false);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileStamN()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileStamN(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[9];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0xA3); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Stam, m.StamMax, true);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileAttributes()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileAttributes(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[17];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0x2D); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Hits, m.HitsMax, false);
|
||||
expectedData.WriteAttribute(ref pos, m.Mana, m.ManaMax, false);
|
||||
expectedData.WriteAttribute(ref pos, m.Stam, m.StamMax, false);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileAttributesN()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileAttributesN(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[17];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0x2D); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Hits, m.HitsMax, true);
|
||||
expectedData.WriteAttribute(ref pos, m.Mana, m.ManaMax, true);
|
||||
expectedData.WriteAttribute(ref pos, m.Stam, m.StamMax, true);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileName()
|
||||
{
|
||||
|
|
@ -887,4 +739,156 @@ namespace Server.Tests.Network.Packets
|
|||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
}
|
||||
|
||||
[Collection("Sequential Tests")]
|
||||
public class SequentialMobilePacketTests : IClassFixture<ServerFixture>
|
||||
{
|
||||
[Fact]
|
||||
public void TestMobileHits()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileHits(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[9];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0xA1); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Hits, m.HitsMax, false);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileHitsN()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileHitsN(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[9];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0xA1); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Hits, m.HitsMax, true);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileMana()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileMana(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[9];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0xA2); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Mana, m.ManaMax, false);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileManaN()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileManaN(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[9];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0xA2); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Mana, m.ManaMax, true);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileStam()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileStam(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[9];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0xA3); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Stam, m.StamMax, false);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileStamN()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileStamN(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[9];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0xA3); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Stam, m.StamMax, true);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileAttributes()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileAttributes(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[17];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0x2D); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Hits, m.HitsMax, false);
|
||||
expectedData.WriteAttribute(ref pos, m.Mana, m.ManaMax, false);
|
||||
expectedData.WriteAttribute(ref pos, m.Stam, m.StamMax, false);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMobileAttributesN()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var data = new MobileAttributesN(m).Compile();
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[17];
|
||||
var pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0x2D); // Packet ID
|
||||
expectedData.Write(ref pos, m.Serial);
|
||||
expectedData.WriteAttribute(ref pos, m.Hits, m.HitsMax, true);
|
||||
expectedData.WriteAttribute(ref pos, m.Mana, m.ManaMax, true);
|
||||
expectedData.WriteAttribute(ref pos, m.Stam, m.StamMax, true);
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Server.Tests
|
||||
{
|
||||
[CollectionDefinition("Sequential Tests", DisableParallelization = true)]
|
||||
public class SequentialTestCollectionDefinition
|
||||
{
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue