Adds more packet tests (#173)

This commit is contained in:
Kamron Batman 2020-07-05 20:14:23 -07:00 • committed by GitHub
parent f868c34678
commit 9d4bc7cda2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 1015 additions and 33 deletions

View file

@ -0,0 +1,43 @@
using System;
using Server.Network;
using Xunit;
namespace Server.Tests.Network.Packets
{
public class LightPacketTests
{
[Fact]
public void TestGlobalLightLevel()
{
byte lightLevel = 5;
Span<byte> data = new GlobalLightLevel(lightLevel).Compile();
Span<byte> expectedData = stackalloc byte[]
{
0x4F, // Packet ID
lightLevel
};
AssertThat.Equal(data, expectedData);
}
[Fact]
public void TestPersonalLightLevel()
{
Serial serial = 0x1;
byte lightLevel = 5;
Span<byte> data = new PersonalLightLevel(serial, lightLevel).Compile();
Span<byte> expectedData = stackalloc byte[]
{
0x4E, // Packet ID
0x00, 0x00, 0x00, 0x00, // Serial
lightLevel
};
serial.CopyTo(expectedData.Slice(1, 4));
AssertThat.Equal(data, expectedData);
}
}
}