Adds more packet tests (#176)
This commit is contained in:
parent
7d20cf7642
commit
c0805850c1
3 changed files with 149 additions and 2 deletions
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Buffers;
|
||||
using Server.Network;
|
||||
using Xunit;
|
||||
|
||||
namespace Server.Tests.Network.Packets
|
||||
{
|
||||
public class ObjectHelpResponseTests
|
||||
{
|
||||
[Fact]
|
||||
public void TestObjectHelpResponse()
|
||||
{
|
||||
Serial s = 0x100;
|
||||
string text = "This is some testing text";
|
||||
|
||||
Span<byte> data = new ObjectHelpResponse(s, text).Compile();
|
||||
|
||||
int length = 9 + text.Length * 2;
|
||||
|
||||
Span<byte> expectedData = stackalloc byte[length];
|
||||
int pos = 0;
|
||||
|
||||
expectedData.Write(ref pos, (byte)0xB7); // Packet ID
|
||||
expectedData.Write(ref pos, (ushort)length); // Length
|
||||
expectedData.Write(ref pos, s);
|
||||
expectedData.WriteBigUni(ref pos, text);
|
||||
|
||||
#if NO_LOCAL_INIT
|
||||
expectedData.Write(ref pos, (ushort)0); // Terminator
|
||||
#endif
|
||||
|
||||
AssertThat.Equal(data, expectedData);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue