The PreBuild targets ran the generator with "--no-build", so it used whatever assemblies happened to sit in its output folder. When that copy of the data model was older than a newly added type, the generator regenerated the checked-in *.Generated.cs files WITHOUT that type and overwrote them in the source tree. Nothing failed at build time: the C# compile stayed green and docker builds (-p:ci=true) skip the generator entirely, so they compiled whatever was in the tree. The damage only surfaced at runtime, when EF validated the model and found the inherited GameConfiguration.CastleSiegeConfiguration navigation pointing at a keyless type - the server died on startup with "The entity type 'CastleSiegeConfiguration' requires a primary key to be defined". Dropping the switch makes the generator build first, so its output always matches the data model. The regenerated files here are that missing output: the Castle Siege mappings, and the packet tests for packets whose XML was already committed. TypedContextModelTests builds the typed context the startup reads its plugin configurations through - the first one to touch the model - so this class of breakage fails in seconds without a database. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
6547 lines
253 KiB
C#
6547 lines
253 KiB
C#
// <copyright file="ServerToClientPacketTests.cs" company="MUnique">
|
|
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
|
|
// </copyright>
|
|
|
|
//------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// This source code was auto-generated by an XSL transformation.
|
|
// Do not change this file. Instead, change the XML data which contains
|
|
// the packet definitions and re-run the transformation (rebuild this project).
|
|
// </auto-generated>
|
|
//------------------------------------------------------------------------------
|
|
|
|
namespace MUnique.OpenMU.Network.Packets.Tests.ServerToClient;
|
|
|
|
using System;
|
|
using System.Text;
|
|
using NUnit.Framework;
|
|
using MUnique.OpenMU.Network.Packets.ServerToClient;
|
|
|
|
/// <summary>
|
|
/// Auto-generated tests for packet structures to validate packet definitions.
|
|
/// </summary>
|
|
[TestFixture]
|
|
public class PacketStructureTests
|
|
{
|
|
|
|
/// <summary>
|
|
/// Tests the structure size calculation for StoredItem.
|
|
/// </summary>
|
|
[Test]
|
|
public void StoredItem_SizeValidation()
|
|
{
|
|
// Variable-length structure validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = StoredItem.GetRequiredSize(testBinaryLength);
|
|
var expectedSize = testBinaryLength + 1;
|
|
|
|
Assert.That(calculatedSize, Is.EqualTo(expectedSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the structure size calculation for PlayerShopItem.
|
|
/// </summary>
|
|
[Test]
|
|
public void PlayerShopItem_SizeValidation()
|
|
{
|
|
// Fixed-length structure validation
|
|
const int expectedLength = 20;
|
|
var actualLength = PlayerShopItem.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Structure length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'ItemSlot' boundary
|
|
Assert.That(0 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ItemSlot' exceeds structure boundary");
|
|
|
|
// Validate field 'ItemData' boundary
|
|
Assert.That(1 + 12, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ItemData' exceeds structure boundary");
|
|
|
|
// Validate field 'Price' boundary
|
|
Assert.That(16 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Price' exceeds structure boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the structure size calculation for PlayerShopItemExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void PlayerShopItemExtended_SizeValidation()
|
|
{
|
|
// Variable-length structure validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = PlayerShopItemExtended.GetRequiredSize(testBinaryLength);
|
|
var expectedSize = testBinaryLength + 9;
|
|
|
|
Assert.That(calculatedSize, Is.EqualTo(expectedSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the structure size calculation for QuestIdentification.
|
|
/// </summary>
|
|
[Test]
|
|
public void QuestIdentification_SizeValidation()
|
|
{
|
|
// Fixed-length structure validation
|
|
const int expectedLength = 4;
|
|
var actualLength = QuestIdentification.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Structure length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Number' boundary
|
|
Assert.That(0 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Number' exceeds structure boundary");
|
|
|
|
// Validate field 'Group' boundary
|
|
Assert.That(2 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Group' exceeds structure boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the structure size calculation for QuestCondition.
|
|
/// </summary>
|
|
[Test]
|
|
public void QuestCondition_SizeValidation()
|
|
{
|
|
// Fixed-length structure validation
|
|
const int expectedLength = 26;
|
|
var actualLength = QuestCondition.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Structure length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Type' boundary
|
|
Assert.That(0 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Type' exceeds structure boundary");
|
|
|
|
// Validate field 'RequirementId' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RequirementId' exceeds structure boundary");
|
|
|
|
// Validate field 'RequiredCount' boundary
|
|
Assert.That(6 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RequiredCount' exceeds structure boundary");
|
|
|
|
// Validate field 'CurrentCount' boundary
|
|
Assert.That(10 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentCount' exceeds structure boundary");
|
|
|
|
// Validate field 'RequiredItemData' boundary
|
|
Assert.That(14 + 12, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RequiredItemData' exceeds structure boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the structure size calculation for QuestReward.
|
|
/// </summary>
|
|
[Test]
|
|
public void QuestReward_SizeValidation()
|
|
{
|
|
// Fixed-length structure validation
|
|
const int expectedLength = 22;
|
|
var actualLength = QuestReward.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Structure length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Type' boundary
|
|
Assert.That(0 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Type' exceeds structure boundary");
|
|
|
|
// Validate field 'RewardId' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RewardId' exceeds structure boundary");
|
|
|
|
// Validate field 'RewardCount' boundary
|
|
Assert.That(6 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RewardCount' exceeds structure boundary");
|
|
|
|
// Validate field 'RewardedItemData' boundary
|
|
Assert.That(10 + 12, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RewardedItemData' exceeds structure boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the structure size calculation for QuestConditionExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void QuestConditionExtended_SizeValidation()
|
|
{
|
|
// Fixed-length structure validation
|
|
const int expectedLength = 28;
|
|
var actualLength = QuestConditionExtended.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Structure length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Type' boundary
|
|
Assert.That(0 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Type' exceeds structure boundary");
|
|
|
|
// Validate field 'RequirementId' boundary
|
|
Assert.That(2 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RequirementId' exceeds structure boundary");
|
|
|
|
// Validate field 'RequiredCount' boundary
|
|
Assert.That(4 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RequiredCount' exceeds structure boundary");
|
|
|
|
// Validate field 'CurrentCount' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentCount' exceeds structure boundary");
|
|
|
|
// Validate field 'RequiredItemData' boundary
|
|
Assert.That(12 + 15, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RequiredItemData' exceeds structure boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the structure size calculation for QuestRewardExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void QuestRewardExtended_SizeValidation()
|
|
{
|
|
// Fixed-length structure validation
|
|
const int expectedLength = 24;
|
|
var actualLength = QuestRewardExtended.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Structure length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Type' boundary
|
|
Assert.That(0 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Type' exceeds structure boundary");
|
|
|
|
// Validate field 'RewardId' boundary
|
|
Assert.That(2 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RewardId' exceeds structure boundary");
|
|
|
|
// Validate field 'RewardCount' boundary
|
|
Assert.That(4 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RewardCount' exceeds structure boundary");
|
|
|
|
// Validate field 'RewardedItemData' boundary
|
|
Assert.That(8 + 15, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RewardedItemData' exceeds structure boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GameServerEntered.
|
|
/// </summary>
|
|
[Test]
|
|
public void GameServerEntered_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 12;
|
|
var actualLength = GameServerEnteredRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Success' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Success' exceeds packet boundary");
|
|
|
|
// Validate field 'PlayerId' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PlayerId' exceeds packet boundary");
|
|
|
|
// Validate field 'VersionString' boundary
|
|
Assert.That(7 + 5, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'VersionString' exceeds packet boundary");
|
|
|
|
// Validate field 'Version' boundary
|
|
Assert.That(7 + 5, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Version' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MagicEffectStatus.
|
|
/// </summary>
|
|
[Test]
|
|
public void MagicEffectStatus_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = MagicEffectStatusRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'IsActive' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsActive' exceeds packet boundary");
|
|
|
|
// Validate field 'PlayerId' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PlayerId' exceeds packet boundary");
|
|
|
|
// Validate field 'EffectId' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'EffectId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for WeatherStatusUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void WeatherStatusUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = WeatherStatusUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Weather' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Weather' exceeds packet boundary");
|
|
|
|
// Validate field 'Variation' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Variation' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AddCharacterToScopeExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void AddCharacterToScopeExtended_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = AddCharacterToScopeExtendedRef.GetRequiredSize(testBinaryLength);
|
|
var expectedMinSize = testBinaryLength + 26;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AddCharactersToScope.
|
|
/// </summary>
|
|
[Test]
|
|
public void AddCharactersToScope_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'CharacterCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'CharacterCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AddCharactersToScope075.
|
|
/// </summary>
|
|
[Test]
|
|
public void AddCharactersToScope075_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'CharacterCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'CharacterCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AddCharactersToScope095.
|
|
/// </summary>
|
|
[Test]
|
|
public void AddCharactersToScope095_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'CharacterCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'CharacterCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AddNpcsToScope.
|
|
/// </summary>
|
|
[Test]
|
|
public void AddNpcsToScope_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'NpcCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'NpcCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AddNpcsToScope075.
|
|
/// </summary>
|
|
[Test]
|
|
public void AddNpcsToScope075_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'NpcCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'NpcCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AddNpcsToScope095.
|
|
/// </summary>
|
|
[Test]
|
|
public void AddNpcsToScope095_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'NpcCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'NpcCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AddSummonedMonstersToScope.
|
|
/// </summary>
|
|
[Test]
|
|
public void AddSummonedMonstersToScope_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'MonsterCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'MonsterCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AddSummonedMonstersToScope075.
|
|
/// </summary>
|
|
[Test]
|
|
public void AddSummonedMonstersToScope075_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'MonsterCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'MonsterCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AddSummonedMonstersToScope095.
|
|
/// </summary>
|
|
[Test]
|
|
public void AddSummonedMonstersToScope095_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'MonsterCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'MonsterCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MapObjectOutOfScope.
|
|
/// </summary>
|
|
[Test]
|
|
public void MapObjectOutOfScope_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'ObjectCount' starts at index 3 with size 1
|
|
Assert.That(3, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'ObjectCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ObjectGotKilled.
|
|
/// </summary>
|
|
[Test]
|
|
public void ObjectGotKilled_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 9;
|
|
var actualLength = ObjectGotKilledRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'KilledId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'KilledId' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillId' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillId' exceeds packet boundary");
|
|
|
|
// Validate field 'KillerId' boundary
|
|
Assert.That(7 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'KillerId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ObjectAnimation.
|
|
/// </summary>
|
|
[Test]
|
|
public void ObjectAnimation_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 9;
|
|
var actualLength = ObjectAnimationRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'ObjectId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ObjectId' exceeds packet boundary");
|
|
|
|
// Validate field 'Direction' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Direction' exceeds packet boundary");
|
|
|
|
// Validate field 'Animation' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Animation' exceeds packet boundary");
|
|
|
|
// Validate field 'TargetId' boundary
|
|
Assert.That(7 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TargetId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AreaSkillAnimation.
|
|
/// </summary>
|
|
[Test]
|
|
public void AreaSkillAnimation_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 10;
|
|
var actualLength = AreaSkillAnimationRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'SkillId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillId' exceeds packet boundary");
|
|
|
|
// Validate field 'PlayerId' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PlayerId' exceeds packet boundary");
|
|
|
|
// Validate field 'PointX' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PointX' exceeds packet boundary");
|
|
|
|
// Validate field 'PointY' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PointY' exceeds packet boundary");
|
|
|
|
// Validate field 'Rotation' boundary
|
|
Assert.That(9 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Rotation' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for SkillAnimation.
|
|
/// </summary>
|
|
[Test]
|
|
public void SkillAnimation_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 9;
|
|
var actualLength = SkillAnimationRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'SkillId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillId' exceeds packet boundary");
|
|
|
|
// Validate field 'PlayerId' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PlayerId' exceeds packet boundary");
|
|
|
|
// Validate field 'TargetId' boundary
|
|
Assert.That(7 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TargetId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AreaSkillAnimation075.
|
|
/// </summary>
|
|
[Test]
|
|
public void AreaSkillAnimation075_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 9;
|
|
var actualLength = AreaSkillAnimation075Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'SkillId' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillId' exceeds packet boundary");
|
|
|
|
// Validate field 'PlayerId' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PlayerId' exceeds packet boundary");
|
|
|
|
// Validate field 'PointX' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PointX' exceeds packet boundary");
|
|
|
|
// Validate field 'PointY' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PointY' exceeds packet boundary");
|
|
|
|
// Validate field 'Rotation' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Rotation' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AreaSkillAnimation095.
|
|
/// </summary>
|
|
[Test]
|
|
public void AreaSkillAnimation095_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 9;
|
|
var actualLength = AreaSkillAnimation095Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'SkillId' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillId' exceeds packet boundary");
|
|
|
|
// Validate field 'PlayerId' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PlayerId' exceeds packet boundary");
|
|
|
|
// Validate field 'PointX' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PointX' exceeds packet boundary");
|
|
|
|
// Validate field 'PointY' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PointY' exceeds packet boundary");
|
|
|
|
// Validate field 'Rotation' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Rotation' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for SkillAnimation075.
|
|
/// </summary>
|
|
[Test]
|
|
public void SkillAnimation075_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = SkillAnimation075Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'SkillId' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillId' exceeds packet boundary");
|
|
|
|
// Validate field 'PlayerId' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PlayerId' exceeds packet boundary");
|
|
|
|
// Validate field 'TargetId' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TargetId' exceeds packet boundary");
|
|
|
|
// Validate field 'EffectApplied' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'EffectApplied' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for SkillAnimation095.
|
|
/// </summary>
|
|
[Test]
|
|
public void SkillAnimation095_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = SkillAnimation095Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'SkillId' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillId' exceeds packet boundary");
|
|
|
|
// Validate field 'PlayerId' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PlayerId' exceeds packet boundary");
|
|
|
|
// Validate field 'TargetId' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TargetId' exceeds packet boundary");
|
|
|
|
// Validate field 'EffectApplied' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'EffectApplied' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MagicEffectCancelled.
|
|
/// </summary>
|
|
[Test]
|
|
public void MagicEffectCancelled_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = MagicEffectCancelledRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'SkillId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillId' exceeds packet boundary");
|
|
|
|
// Validate field 'TargetId' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TargetId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MagicEffectCancelled075.
|
|
/// </summary>
|
|
[Test]
|
|
public void MagicEffectCancelled075_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 6;
|
|
var actualLength = MagicEffectCancelled075Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'SkillId' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillId' exceeds packet boundary");
|
|
|
|
// Validate field 'TargetId' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TargetId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for RageAttack.
|
|
/// </summary>
|
|
[Test]
|
|
public void RageAttack_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 9;
|
|
var actualLength = RageAttackRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'SkillId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillId' exceeds packet boundary");
|
|
|
|
// Validate field 'SourceId' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SourceId' exceeds packet boundary");
|
|
|
|
// Validate field 'TargetId' boundary
|
|
Assert.That(7 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TargetId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for RageAttackRangeResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void RageAttackRangeResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 16;
|
|
var actualLength = RageAttackRangeResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'SkillId' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AppearanceChanged.
|
|
/// </summary>
|
|
[Test]
|
|
public void AppearanceChanged_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = AppearanceChangedRef.GetRequiredSize(testBinaryLength);
|
|
var expectedMinSize = testBinaryLength + 5;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AppearanceChangedExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void AppearanceChangedExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 14;
|
|
var actualLength = AppearanceChangedExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'ChangedPlayerId' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ChangedPlayerId' exceeds packet boundary");
|
|
|
|
// Validate field 'ItemSlot' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ItemSlot' exceeds packet boundary");
|
|
|
|
// Validate field 'ItemGroup' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ItemGroup' exceeds packet boundary");
|
|
|
|
// Validate field 'ItemNumber' boundary
|
|
Assert.That(8 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ItemNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'ItemLevel' boundary
|
|
Assert.That(10 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ItemLevel' exceeds packet boundary");
|
|
|
|
// Validate field 'ExcellentFlags' boundary
|
|
Assert.That(11 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ExcellentFlags' exceeds packet boundary");
|
|
|
|
// Validate field 'AncientDiscriminator' boundary
|
|
Assert.That(12 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'AncientDiscriminator' exceeds packet boundary");
|
|
|
|
// Validate field 'IsAncientSetComplete' boundary
|
|
Assert.That(13 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsAncientSetComplete' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ObjectMessage.
|
|
/// </summary>
|
|
[Test]
|
|
public void ObjectMessage_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const string testString = "TestData";
|
|
var calculatedSize = ObjectMessageRef.GetRequiredSize(testString);
|
|
var expectedMinSize = Encoding.UTF8.GetByteCount(testString) + 1 + 5;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for string field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PartyRequest.
|
|
/// </summary>
|
|
[Test]
|
|
public void PartyRequest_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = PartyRequestRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'RequesterId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RequesterId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PartyList.
|
|
/// </summary>
|
|
[Test]
|
|
public void PartyList_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'Count' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Count' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PartyList075.
|
|
/// </summary>
|
|
[Test]
|
|
public void PartyList075_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'Count' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Count' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for RemovePartyMember.
|
|
/// </summary>
|
|
[Test]
|
|
public void RemovePartyMember_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = RemovePartyMemberRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Index' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Index' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PartyHealthUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void PartyHealthUpdate_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'Count' starts at index 3 with size 1
|
|
Assert.That(3, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Count' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PlayerShopOpenSuccessful.
|
|
/// </summary>
|
|
[Test]
|
|
public void PlayerShopOpenSuccessful_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = PlayerShopOpenSuccessfulRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Success' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Success' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for TradeButtonStateChanged.
|
|
/// </summary>
|
|
[Test]
|
|
public void TradeButtonStateChanged_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = TradeButtonStateChangedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'State' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'State' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for TradeMoneySetResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void TradeMoneySetResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = TradeMoneySetResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for TradeMoneyUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void TradeMoneyUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = TradeMoneyUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'MoneyAmount' boundary
|
|
Assert.That(4 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MoneyAmount' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for TradeRequestAnswer.
|
|
/// </summary>
|
|
[Test]
|
|
public void TradeRequestAnswer_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 20;
|
|
var actualLength = TradeRequestAnswerRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Accepted' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Accepted' exceeds packet boundary");
|
|
|
|
// Validate field 'Name' boundary
|
|
Assert.That(4 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Name' exceeds packet boundary");
|
|
|
|
// Validate field 'TradePartnerLevel' boundary
|
|
Assert.That(14 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TradePartnerLevel' exceeds packet boundary");
|
|
|
|
// Validate field 'GuildId' boundary
|
|
Assert.That(16 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'GuildId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for TradeRequest.
|
|
/// </summary>
|
|
[Test]
|
|
public void TradeRequest_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 13;
|
|
var actualLength = TradeRequestRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Name' boundary
|
|
Assert.That(3 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Name' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for TradeFinished.
|
|
/// </summary>
|
|
[Test]
|
|
public void TradeFinished_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = TradeFinishedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for TradeItemAdded.
|
|
/// </summary>
|
|
[Test]
|
|
public void TradeItemAdded_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = TradeItemAddedRef.GetRequiredSize(testBinaryLength);
|
|
var expectedMinSize = testBinaryLength + 4;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for TradeItemRemoved.
|
|
/// </summary>
|
|
[Test]
|
|
public void TradeItemRemoved_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = TradeItemRemovedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Slot' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Slot' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for LoginResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void LoginResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = LoginResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Success' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Success' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for LogoutResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void LogoutResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = LogoutResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Type' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Type' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ChatMessage.
|
|
/// </summary>
|
|
[Test]
|
|
public void ChatMessage_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const string testString = "TestData";
|
|
var calculatedSize = ChatMessageRef.GetRequiredSize(testString);
|
|
var expectedMinSize = Encoding.UTF8.GetByteCount(testString) + 1 + 13;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for string field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ObjectHit.
|
|
/// </summary>
|
|
[Test]
|
|
public void ObjectHit_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 10;
|
|
var actualLength = ObjectHitRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'HeaderCode' boundary
|
|
Assert.That(2 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'HeaderCode' exceeds packet boundary");
|
|
|
|
// Validate field 'ObjectId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ObjectId' exceeds packet boundary");
|
|
|
|
// Validate field 'HealthDamage' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'HealthDamage' exceeds packet boundary");
|
|
|
|
// Validate field 'Kind' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Kind' exceeds packet boundary");
|
|
|
|
// Validate field 'IsRageFighterStreakHit' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsRageFighterStreakHit' exceeds packet boundary");
|
|
|
|
// Validate field 'IsRageFighterStreakFinalHit' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsRageFighterStreakFinalHit' exceeds packet boundary");
|
|
|
|
// Validate field 'IsDoubleDamage' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsDoubleDamage' exceeds packet boundary");
|
|
|
|
// Validate field 'IsTripleDamage' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsTripleDamage' exceeds packet boundary");
|
|
|
|
// Validate field 'ShieldDamage' boundary
|
|
Assert.That(8 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ShieldDamage' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ObjectHitExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void ObjectHitExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 16;
|
|
var actualLength = ObjectHitExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Kind' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Kind' exceeds packet boundary");
|
|
|
|
// Validate field 'IsRageFighterStreakHit' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsRageFighterStreakHit' exceeds packet boundary");
|
|
|
|
// Validate field 'IsRageFighterStreakFinalHit' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsRageFighterStreakFinalHit' exceeds packet boundary");
|
|
|
|
// Validate field 'IsDoubleDamage' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsDoubleDamage' exceeds packet boundary");
|
|
|
|
// Validate field 'IsTripleDamage' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsTripleDamage' exceeds packet boundary");
|
|
|
|
// Validate field 'ObjectId' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ObjectId' exceeds packet boundary");
|
|
|
|
// Validate field 'HealthStatus' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'HealthStatus' exceeds packet boundary");
|
|
|
|
// Validate field 'ShieldStatus' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ShieldStatus' exceeds packet boundary");
|
|
|
|
// Validate field 'HealthDamage' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'HealthDamage' exceeds packet boundary");
|
|
|
|
// Validate field 'ShieldDamage' boundary
|
|
Assert.That(12 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ShieldDamage' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ObjectMoved.
|
|
/// </summary>
|
|
[Test]
|
|
public void ObjectMoved_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = ObjectMovedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'HeaderCode' boundary
|
|
Assert.That(2 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'HeaderCode' exceeds packet boundary");
|
|
|
|
// Validate field 'ObjectId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ObjectId' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionX' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionX' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionY' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionY' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ObjectWalked.
|
|
/// </summary>
|
|
[Test]
|
|
public void ObjectWalked_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = ObjectWalkedRef.GetRequiredSize(testBinaryLength);
|
|
var expectedMinSize = testBinaryLength + 8;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ObjectWalkedExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void ObjectWalkedExtended_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = ObjectWalkedExtendedRef.GetRequiredSize(testBinaryLength);
|
|
var expectedMinSize = testBinaryLength + 10;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ObjectWalked075.
|
|
/// </summary>
|
|
[Test]
|
|
public void ObjectWalked075_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = ObjectWalked075Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'ObjectId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ObjectId' exceeds packet boundary");
|
|
|
|
// Validate field 'TargetX' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TargetX' exceeds packet boundary");
|
|
|
|
// Validate field 'TargetY' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TargetY' exceeds packet boundary");
|
|
|
|
// Validate field 'TargetRotation' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TargetRotation' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ExperienceGained.
|
|
/// </summary>
|
|
[Test]
|
|
public void ExperienceGained_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 9;
|
|
var actualLength = ExperienceGainedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'KilledObjectId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'KilledObjectId' exceeds packet boundary");
|
|
|
|
// Validate field 'AddedExperience' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'AddedExperience' exceeds packet boundary");
|
|
|
|
// Validate field 'DamageOfLastHit' boundary
|
|
Assert.That(7 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'DamageOfLastHit' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ExperienceGainedExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void ExperienceGainedExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 16;
|
|
var actualLength = ExperienceGainedExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Type' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Type' exceeds packet boundary");
|
|
|
|
// Validate field 'AddedExperience' boundary
|
|
Assert.That(4 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'AddedExperience' exceeds packet boundary");
|
|
|
|
// Validate field 'DamageOfLastHit' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'DamageOfLastHit' exceeds packet boundary");
|
|
|
|
// Validate field 'KilledObjectId' boundary
|
|
Assert.That(12 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'KilledObjectId' exceeds packet boundary");
|
|
|
|
// Validate field 'KillerObjectId' boundary
|
|
Assert.That(14 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'KillerObjectId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MapChanged.
|
|
/// </summary>
|
|
[Test]
|
|
public void MapChanged_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 15;
|
|
var actualLength = MapChangedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'IsMapChange' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsMapChange' exceeds packet boundary");
|
|
|
|
// Validate field 'MapNumber' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MapNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionX' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionX' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionY' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionY' exceeds packet boundary");
|
|
|
|
// Validate field 'Rotation' boundary
|
|
Assert.That(9 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Rotation' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MapChanged075.
|
|
/// </summary>
|
|
[Test]
|
|
public void MapChanged075_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = MapChanged075Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'IsMapChange' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsMapChange' exceeds packet boundary");
|
|
|
|
// Validate field 'MapNumber' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MapNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionX' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionX' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionY' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionY' exceeds packet boundary");
|
|
|
|
// Validate field 'Rotation' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Rotation' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ApplyKeyConfiguration.
|
|
/// </summary>
|
|
[Test]
|
|
public void ApplyKeyConfiguration_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = ApplyKeyConfigurationRef.GetRequiredSize(testBinaryLength);
|
|
var expectedMinSize = testBinaryLength + 4;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ItemsDropped.
|
|
/// </summary>
|
|
[Test]
|
|
public void ItemsDropped_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'ItemCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'ItemCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MoneyDropped.
|
|
/// </summary>
|
|
[Test]
|
|
public void MoneyDropped_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 21;
|
|
var actualLength = MoneyDroppedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'ItemCount' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ItemCount' exceeds packet boundary");
|
|
|
|
// Validate field 'Id' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Id' exceeds packet boundary");
|
|
|
|
// Validate field 'IsFreshDrop' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsFreshDrop' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionX' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionX' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionY' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionY' exceeds packet boundary");
|
|
|
|
// Validate field 'MoneyNumber' boundary
|
|
Assert.That(9 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MoneyNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'Amount' boundary
|
|
Assert.That(10 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Amount' exceeds packet boundary");
|
|
|
|
// Validate field 'MoneyGroup' boundary
|
|
Assert.That(14 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MoneyGroup' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MoneyDroppedExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void MoneyDroppedExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 12;
|
|
var actualLength = MoneyDroppedExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'IsFreshDrop' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsFreshDrop' exceeds packet boundary");
|
|
|
|
// Validate field 'Id' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Id' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionX' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionX' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionY' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionY' exceeds packet boundary");
|
|
|
|
// Validate field 'Amount' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Amount' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MoneyDropped075.
|
|
/// </summary>
|
|
[Test]
|
|
public void MoneyDropped075_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 14;
|
|
var actualLength = MoneyDropped075Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'ItemCount' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ItemCount' exceeds packet boundary");
|
|
|
|
// Validate field 'Id' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Id' exceeds packet boundary");
|
|
|
|
// Validate field 'IsFreshDrop' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsFreshDrop' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionX' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionX' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionY' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionY' exceeds packet boundary");
|
|
|
|
// Validate field 'MoneyNumber' boundary
|
|
Assert.That(9 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MoneyNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'MoneyGroup' boundary
|
|
Assert.That(9 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MoneyGroup' exceeds packet boundary");
|
|
|
|
// Validate field 'Amount' boundary
|
|
Assert.That(10 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Amount' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ItemDropRemoved.
|
|
/// </summary>
|
|
[Test]
|
|
public void ItemDropRemoved_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'ItemCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'ItemCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ItemAddedToInventory.
|
|
/// </summary>
|
|
[Test]
|
|
public void ItemAddedToInventory_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = ItemAddedToInventoryRef.GetRequiredSize(testBinaryLength);
|
|
var expectedMinSize = testBinaryLength + 4;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ItemDropResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void ItemDropResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = ItemDropResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Success' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Success' exceeds packet boundary");
|
|
|
|
// Validate field 'InventorySlot' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'InventorySlot' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ItemPickUpRequestFailed.
|
|
/// </summary>
|
|
[Test]
|
|
public void ItemPickUpRequestFailed_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = ItemPickUpRequestFailedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'FailReason' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'FailReason' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for InventoryMoneyUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void InventoryMoneyUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = InventoryMoneyUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Money' boundary
|
|
Assert.That(4 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Money' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ItemMoved.
|
|
/// </summary>
|
|
[Test]
|
|
public void ItemMoved_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = ItemMovedRef.GetRequiredSize(testBinaryLength);
|
|
var expectedMinSize = testBinaryLength + 5;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ItemMoveRequestFailed.
|
|
/// </summary>
|
|
[Test]
|
|
public void ItemMoveRequestFailed_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = ItemMoveRequestFailedRef.GetRequiredSize(testBinaryLength);
|
|
var expectedMinSize = testBinaryLength + 5;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CurrentHealthAndShield.
|
|
/// </summary>
|
|
[Test]
|
|
public void CurrentHealthAndShield_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 9;
|
|
var actualLength = CurrentHealthAndShieldRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Health' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Health' exceeds packet boundary");
|
|
|
|
// Validate field 'Shield' boundary
|
|
Assert.That(7 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Shield' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MaximumHealthAndShield.
|
|
/// </summary>
|
|
[Test]
|
|
public void MaximumHealthAndShield_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 9;
|
|
var actualLength = MaximumHealthAndShieldRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Health' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Health' exceeds packet boundary");
|
|
|
|
// Validate field 'Shield' boundary
|
|
Assert.That(7 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Shield' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CurrentStatsExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void CurrentStatsExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 24;
|
|
var actualLength = CurrentStatsExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Health' boundary
|
|
Assert.That(4 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Health' exceeds packet boundary");
|
|
|
|
// Validate field 'Shield' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Shield' exceeds packet boundary");
|
|
|
|
// Validate field 'Mana' boundary
|
|
Assert.That(12 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Mana' exceeds packet boundary");
|
|
|
|
// Validate field 'Ability' boundary
|
|
Assert.That(16 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Ability' exceeds packet boundary");
|
|
|
|
// Validate field 'AttackSpeed' boundary
|
|
Assert.That(20 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'AttackSpeed' exceeds packet boundary");
|
|
|
|
// Validate field 'MagicSpeed' boundary
|
|
Assert.That(22 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MagicSpeed' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MaximumStatsExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void MaximumStatsExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 20;
|
|
var actualLength = MaximumStatsExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Health' boundary
|
|
Assert.That(4 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Health' exceeds packet boundary");
|
|
|
|
// Validate field 'Shield' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Shield' exceeds packet boundary");
|
|
|
|
// Validate field 'Mana' boundary
|
|
Assert.That(12 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Mana' exceeds packet boundary");
|
|
|
|
// Validate field 'Ability' boundary
|
|
Assert.That(16 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Ability' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ItemConsumptionFailed.
|
|
/// </summary>
|
|
[Test]
|
|
public void ItemConsumptionFailed_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 9;
|
|
var actualLength = ItemConsumptionFailedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Health' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Health' exceeds packet boundary");
|
|
|
|
// Validate field 'Shield' boundary
|
|
Assert.That(7 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Shield' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ItemConsumptionFailedExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void ItemConsumptionFailedExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 12;
|
|
var actualLength = ItemConsumptionFailedExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Health' boundary
|
|
Assert.That(4 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Health' exceeds packet boundary");
|
|
|
|
// Validate field 'Shield' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Shield' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for BaseStatsExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void BaseStatsExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 24;
|
|
var actualLength = BaseStatsExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Strength' boundary
|
|
Assert.That(4 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Strength' exceeds packet boundary");
|
|
|
|
// Validate field 'Agility' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Agility' exceeds packet boundary");
|
|
|
|
// Validate field 'Vitality' boundary
|
|
Assert.That(12 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Vitality' exceeds packet boundary");
|
|
|
|
// Validate field 'Energy' boundary
|
|
Assert.That(16 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Energy' exceeds packet boundary");
|
|
|
|
// Validate field 'Command' boundary
|
|
Assert.That(20 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Command' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CurrentManaAndAbility.
|
|
/// </summary>
|
|
[Test]
|
|
public void CurrentManaAndAbility_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = CurrentManaAndAbilityRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Mana' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Mana' exceeds packet boundary");
|
|
|
|
// Validate field 'Ability' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Ability' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MaximumManaAndAbility.
|
|
/// </summary>
|
|
[Test]
|
|
public void MaximumManaAndAbility_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = MaximumManaAndAbilityRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Mana' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Mana' exceeds packet boundary");
|
|
|
|
// Validate field 'Ability' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Ability' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ItemRemoved.
|
|
/// </summary>
|
|
[Test]
|
|
public void ItemRemoved_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = ItemRemovedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'InventorySlot' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'InventorySlot' exceeds packet boundary");
|
|
|
|
// Validate field 'TrueFlag' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TrueFlag' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ConsumeItemWithEffect.
|
|
/// </summary>
|
|
[Test]
|
|
public void ConsumeItemWithEffect_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 6;
|
|
var actualLength = ConsumeItemWithEffectRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'ItemType' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ItemType' exceeds packet boundary");
|
|
|
|
// Validate field 'EffectTimeInSeconds' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'EffectTimeInSeconds' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ItemDurabilityChanged.
|
|
/// </summary>
|
|
[Test]
|
|
public void ItemDurabilityChanged_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 6;
|
|
var actualLength = ItemDurabilityChangedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'InventorySlot' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'InventorySlot' exceeds packet boundary");
|
|
|
|
// Validate field 'Durability' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Durability' exceeds packet boundary");
|
|
|
|
// Validate field 'ByConsumption' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ByConsumption' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for FruitConsumptionResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void FruitConsumptionResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = FruitConsumptionResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
|
|
// Validate field 'StatPoints' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'StatPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'StatType' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'StatType' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for EffectItemConsumption.
|
|
/// </summary>
|
|
[Test]
|
|
public void EffectItemConsumption_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 17;
|
|
var actualLength = EffectItemConsumptionRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Origin' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Origin' exceeds packet boundary");
|
|
|
|
// Validate field 'Type' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Type' exceeds packet boundary");
|
|
|
|
// Validate field 'Action' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Action' exceeds packet boundary");
|
|
|
|
// Validate field 'RemainingSeconds' boundary
|
|
Assert.That(12 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RemainingSeconds' exceeds packet boundary");
|
|
|
|
// Validate field 'MagicEffectNumber' boundary
|
|
Assert.That(16 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MagicEffectNumber' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for NpcWindowResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void NpcWindowResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 11;
|
|
var actualLength = NpcWindowResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Window' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Window' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for StoreItemList.
|
|
/// </summary>
|
|
[Test]
|
|
public void StoreItemList_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'Type' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Type' has invalid negative index");
|
|
|
|
// Field 'ItemCount' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'ItemCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for NpcItemBuyFailed.
|
|
/// </summary>
|
|
[Test]
|
|
public void NpcItemBuyFailed_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = NpcItemBuyFailedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ItemBought.
|
|
/// </summary>
|
|
[Test]
|
|
public void ItemBought_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = ItemBoughtRef.GetRequiredSize(testBinaryLength);
|
|
var expectedMinSize = testBinaryLength + 4;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for NpcItemSellResult.
|
|
/// </summary>
|
|
[Test]
|
|
public void NpcItemSellResult_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = NpcItemSellResultRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Success' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Success' exceeds packet boundary");
|
|
|
|
// Validate field 'Money' boundary
|
|
Assert.That(4 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Money' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PlayerShopSetItemPriceResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void PlayerShopSetItemPriceResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 6;
|
|
var actualLength = PlayerShopSetItemPriceResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'InventorySlot' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'InventorySlot' exceeds packet boundary");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PlayerShopClosed.
|
|
/// </summary>
|
|
[Test]
|
|
public void PlayerShopClosed_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = PlayerShopClosedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Success' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Success' exceeds packet boundary");
|
|
|
|
// Validate field 'PlayerId' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PlayerId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PlayerShopItemSoldToPlayer.
|
|
/// </summary>
|
|
[Test]
|
|
public void PlayerShopItemSoldToPlayer_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 15;
|
|
var actualLength = PlayerShopItemSoldToPlayerRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'InventorySlot' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'InventorySlot' exceeds packet boundary");
|
|
|
|
// Validate field 'BuyerName' boundary
|
|
Assert.That(5 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'BuyerName' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ClosePlayerShopDialog.
|
|
/// </summary>
|
|
[Test]
|
|
public void ClosePlayerShopDialog_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 6;
|
|
var actualLength = ClosePlayerShopDialogRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'PlayerId' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PlayerId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PlayerShopItemList.
|
|
/// </summary>
|
|
[Test]
|
|
public void PlayerShopItemList_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'Action' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Action' has invalid negative index");
|
|
|
|
// Field 'Success' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Success' has invalid negative index");
|
|
|
|
// Field 'PlayerId' starts at index 6 with size 2
|
|
Assert.That(6, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'PlayerId' has invalid negative index");
|
|
|
|
// Field 'PlayerName' starts at index 8 with size 10
|
|
Assert.That(8, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'PlayerName' has invalid negative index");
|
|
|
|
// Field 'ShopName' starts at index 18 with size 36
|
|
Assert.That(18, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'ShopName' has invalid negative index");
|
|
|
|
// Field 'ItemCount' starts at index 54 with size 1
|
|
Assert.That(54, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'ItemCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PlayerShopBuyResult.
|
|
/// </summary>
|
|
[Test]
|
|
public void PlayerShopBuyResult_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 21;
|
|
var actualLength = PlayerShopBuyResultRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
|
|
// Validate field 'SellerId' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SellerId' exceeds packet boundary");
|
|
|
|
// Validate field 'ItemData' boundary
|
|
Assert.That(7 + 13, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ItemData' exceeds packet boundary");
|
|
|
|
// Validate field 'ItemSlot' boundary
|
|
Assert.That(20 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ItemSlot' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PlayerShopBuyResultExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void PlayerShopBuyResultExtended_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = PlayerShopBuyResultExtendedRef.GetRequiredSize(testBinaryLength);
|
|
var expectedMinSize = testBinaryLength + 8;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PlayerShopItemListExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void PlayerShopItemListExtended_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'Action' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Action' has invalid negative index");
|
|
|
|
// Field 'Success' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Success' has invalid negative index");
|
|
|
|
// Field 'PlayerId' starts at index 6 with size 2
|
|
Assert.That(6, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'PlayerId' has invalid negative index");
|
|
|
|
// Field 'PlayerName' starts at index 8 with size 10
|
|
Assert.That(8, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'PlayerName' has invalid negative index");
|
|
|
|
// Field 'ShopName' starts at index 18 with size 36
|
|
Assert.That(18, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'ShopName' has invalid negative index");
|
|
|
|
// Field 'ItemCount' starts at index 54 with size 1
|
|
Assert.That(54, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'ItemCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PlayerShops.
|
|
/// </summary>
|
|
[Test]
|
|
public void PlayerShops_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'ShopCount' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'ShopCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AddTransformedCharactersToScope075.
|
|
/// </summary>
|
|
[Test]
|
|
public void AddTransformedCharactersToScope075_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'CharacterCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'CharacterCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AddTransformedCharactersToScope.
|
|
/// </summary>
|
|
[Test]
|
|
public void AddTransformedCharactersToScope_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'CharacterCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'CharacterCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ChangeTerrainAttributes.
|
|
/// </summary>
|
|
[Test]
|
|
public void ChangeTerrainAttributes_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'Type' starts at index 3 with size 1
|
|
Assert.That(3, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Type' has invalid negative index");
|
|
|
|
// Field 'Attribute' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Attribute' has invalid negative index");
|
|
|
|
// Field 'RemoveAttribute' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'RemoveAttribute' has invalid negative index");
|
|
|
|
// Field 'AreaCount' starts at index 6 with size 1
|
|
Assert.That(6, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'AreaCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ShowEffect.
|
|
/// </summary>
|
|
[Test]
|
|
public void ShowEffect_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 6;
|
|
var actualLength = ShowEffectRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'PlayerId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PlayerId' exceeds packet boundary");
|
|
|
|
// Validate field 'Effect' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Effect' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterList.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterList_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'UnlockFlags' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'UnlockFlags' has invalid negative index");
|
|
|
|
// Field 'MoveCnt' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'MoveCnt' has invalid negative index");
|
|
|
|
// Field 'CharacterCount' starts at index 6 with size 1
|
|
Assert.That(6, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'CharacterCount' has invalid negative index");
|
|
|
|
// Field 'IsVaultExtended' starts at index 7 with size 1
|
|
Assert.That(7, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'IsVaultExtended' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterListExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterListExtended_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'UnlockFlags' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'UnlockFlags' has invalid negative index");
|
|
|
|
// Field 'MoveCnt' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'MoveCnt' has invalid negative index");
|
|
|
|
// Field 'CharacterCount' starts at index 6 with size 1
|
|
Assert.That(6, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'CharacterCount' has invalid negative index");
|
|
|
|
// Field 'IsVaultExtended' starts at index 7 with size 1
|
|
Assert.That(7, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'IsVaultExtended' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterClassCreationUnlock.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterClassCreationUnlock_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = CharacterClassCreationUnlockRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'UnlockFlags' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UnlockFlags' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterList075.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterList075_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'CharacterCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'CharacterCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterList095.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterList095_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'CharacterCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'CharacterCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterCreationSuccessful.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterCreationSuccessful_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = CharacterCreationSuccessfulRef.GetRequiredSize(testBinaryLength);
|
|
var expectedMinSize = testBinaryLength + 20;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterCreationFailed.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterCreationFailed_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = CharacterCreationFailedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for RespawnAfterDeath075.
|
|
/// </summary>
|
|
[Test]
|
|
public void RespawnAfterDeath075_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 20;
|
|
var actualLength = RespawnAfterDeath075Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'PositionX' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionX' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionY' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionY' exceeds packet boundary");
|
|
|
|
// Validate field 'MapNumber' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MapNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'Direction' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Direction' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentHealth' boundary
|
|
Assert.That(8 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentMana' boundary
|
|
Assert.That(10 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentMana' exceeds packet boundary");
|
|
|
|
// Validate field 'Experience' boundary
|
|
Assert.That(12 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Experience' exceeds packet boundary");
|
|
|
|
// Validate field 'Money' boundary
|
|
Assert.That(16 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Money' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for RespawnAfterDeath095.
|
|
/// </summary>
|
|
[Test]
|
|
public void RespawnAfterDeath095_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 22;
|
|
var actualLength = RespawnAfterDeath095Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'PositionX' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionX' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionY' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionY' exceeds packet boundary");
|
|
|
|
// Validate field 'MapNumber' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MapNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'Direction' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Direction' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentHealth' boundary
|
|
Assert.That(8 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentMana' boundary
|
|
Assert.That(10 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentMana' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentAbility' boundary
|
|
Assert.That(12 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentAbility' exceeds packet boundary");
|
|
|
|
// Validate field 'Experience' boundary
|
|
Assert.That(14 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Experience' exceeds packet boundary");
|
|
|
|
// Validate field 'Money' boundary
|
|
Assert.That(18 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Money' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for RespawnAfterDeath.
|
|
/// </summary>
|
|
[Test]
|
|
public void RespawnAfterDeath_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 28;
|
|
var actualLength = RespawnAfterDeathRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'PositionX' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionX' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionY' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionY' exceeds packet boundary");
|
|
|
|
// Validate field 'MapNumber' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MapNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'Direction' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Direction' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentHealth' boundary
|
|
Assert.That(8 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentMana' boundary
|
|
Assert.That(10 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentMana' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentShield' boundary
|
|
Assert.That(12 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentShield' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentAbility' boundary
|
|
Assert.That(14 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentAbility' exceeds packet boundary");
|
|
|
|
// Validate field 'Experience' boundary
|
|
Assert.That(16 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Experience' exceeds packet boundary");
|
|
|
|
// Validate field 'Money' boundary
|
|
Assert.That(24 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Money' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for RespawnAfterDeathExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void RespawnAfterDeathExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 36;
|
|
var actualLength = RespawnAfterDeathExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'PositionX' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionX' exceeds packet boundary");
|
|
|
|
// Validate field 'PositionY' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PositionY' exceeds packet boundary");
|
|
|
|
// Validate field 'MapNumber' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MapNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'Direction' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Direction' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentHealth' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentMana' boundary
|
|
Assert.That(12 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentMana' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentShield' boundary
|
|
Assert.That(16 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentShield' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentAbility' boundary
|
|
Assert.That(20 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentAbility' exceeds packet boundary");
|
|
|
|
// Validate field 'Experience' boundary
|
|
Assert.That(24 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Experience' exceeds packet boundary");
|
|
|
|
// Validate field 'Money' boundary
|
|
Assert.That(32 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Money' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PoisonDamage.
|
|
/// </summary>
|
|
[Test]
|
|
public void PoisonDamage_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = PoisonDamageRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'HealthDamage' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'HealthDamage' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentShield' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentShield' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for HeroStateChanged.
|
|
/// </summary>
|
|
[Test]
|
|
public void HeroStateChanged_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = HeroStateChangedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'PlayerId' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PlayerId' exceeds packet boundary");
|
|
|
|
// Validate field 'NewState' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'NewState' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for SkillAdded.
|
|
/// </summary>
|
|
[Test]
|
|
public void SkillAdded_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 10;
|
|
var actualLength = SkillAddedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Flag' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Flag' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillIndex' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillIndex' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillNumber' boundary
|
|
Assert.That(7 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillLevel' boundary
|
|
Assert.That(9 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillLevel' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for SkillRemoved.
|
|
/// </summary>
|
|
[Test]
|
|
public void SkillRemoved_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 10;
|
|
var actualLength = SkillRemovedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Flag' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Flag' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillIndex' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillIndex' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillNumber' boundary
|
|
Assert.That(7 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillNumber' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for SkillListUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void SkillListUpdate_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'Count' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Count' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for SkillAdded075.
|
|
/// </summary>
|
|
[Test]
|
|
public void SkillAdded075_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = SkillAdded075Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Flag' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Flag' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillIndex' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillIndex' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillNumberAndLevel' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillNumberAndLevel' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for SkillRemoved075.
|
|
/// </summary>
|
|
[Test]
|
|
public void SkillRemoved075_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 10;
|
|
var actualLength = SkillRemoved075Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Flag' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Flag' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillIndex' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillIndex' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillNumberAndLevel' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillNumberAndLevel' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for SkillAdded095.
|
|
/// </summary>
|
|
[Test]
|
|
public void SkillAdded095_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = SkillAdded095Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Flag' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Flag' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillIndex' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillIndex' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillNumberAndLevel' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillNumberAndLevel' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for SkillRemoved095.
|
|
/// </summary>
|
|
[Test]
|
|
public void SkillRemoved095_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 10;
|
|
var actualLength = SkillRemoved095Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Flag' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Flag' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillIndex' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillIndex' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillNumberAndLevel' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillNumberAndLevel' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for SkillListUpdate075.
|
|
/// </summary>
|
|
[Test]
|
|
public void SkillListUpdate075_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'Count' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Count' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterFocused.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterFocused_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 15;
|
|
var actualLength = CharacterFocusedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'CharacterName' boundary
|
|
Assert.That(4 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CharacterName' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterStatIncreaseResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterStatIncreaseResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 12;
|
|
var actualLength = CharacterStatIncreaseResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Success' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Success' exceeds packet boundary");
|
|
|
|
// Validate field 'Attribute' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Attribute' exceeds packet boundary");
|
|
|
|
// Validate field 'UpdatedDependentMaximumStat' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UpdatedDependentMaximumStat' exceeds packet boundary");
|
|
|
|
// Validate field 'UpdatedMaximumShield' boundary
|
|
Assert.That(8 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UpdatedMaximumShield' exceeds packet boundary");
|
|
|
|
// Validate field 'UpdatedMaximumAbility' boundary
|
|
Assert.That(10 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UpdatedMaximumAbility' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterStatIncreaseResponseExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterStatIncreaseResponseExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 24;
|
|
var actualLength = CharacterStatIncreaseResponseExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Attribute' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Attribute' exceeds packet boundary");
|
|
|
|
// Validate field 'AddedAmount' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'AddedAmount' exceeds packet boundary");
|
|
|
|
// Validate field 'UpdatedMaximumHealth' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UpdatedMaximumHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'UpdatedMaximumMana' boundary
|
|
Assert.That(12 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UpdatedMaximumMana' exceeds packet boundary");
|
|
|
|
// Validate field 'UpdatedMaximumShield' boundary
|
|
Assert.That(16 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UpdatedMaximumShield' exceeds packet boundary");
|
|
|
|
// Validate field 'UpdatedMaximumAbility' boundary
|
|
Assert.That(20 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UpdatedMaximumAbility' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterDeleteResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterDeleteResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = CharacterDeleteResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterLevelUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterLevelUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 24;
|
|
var actualLength = CharacterLevelUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Level' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Level' exceeds packet boundary");
|
|
|
|
// Validate field 'LevelUpPoints' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'LevelUpPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumHealth' boundary
|
|
Assert.That(8 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumMana' boundary
|
|
Assert.That(10 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumMana' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumShield' boundary
|
|
Assert.That(12 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumShield' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumAbility' boundary
|
|
Assert.That(14 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumAbility' exceeds packet boundary");
|
|
|
|
// Validate field 'FruitPoints' boundary
|
|
Assert.That(16 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'FruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumFruitPoints' boundary
|
|
Assert.That(18 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumFruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'NegativeFruitPoints' boundary
|
|
Assert.That(20 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'NegativeFruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumNegativeFruitPoints' boundary
|
|
Assert.That(22 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumNegativeFruitPoints' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterInformation.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterInformation_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 72;
|
|
var actualLength = CharacterInformationRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'X' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'X' exceeds packet boundary");
|
|
|
|
// Validate field 'Y' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Y' exceeds packet boundary");
|
|
|
|
// Validate field 'MapId' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MapId' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentExperience' boundary
|
|
Assert.That(8 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentExperience' exceeds packet boundary");
|
|
|
|
// Validate field 'ExperienceForNextLevel' boundary
|
|
Assert.That(16 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ExperienceForNextLevel' exceeds packet boundary");
|
|
|
|
// Validate field 'LevelUpPoints' boundary
|
|
Assert.That(24 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'LevelUpPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'Strength' boundary
|
|
Assert.That(26 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Strength' exceeds packet boundary");
|
|
|
|
// Validate field 'Agility' boundary
|
|
Assert.That(28 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Agility' exceeds packet boundary");
|
|
|
|
// Validate field 'Vitality' boundary
|
|
Assert.That(30 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Vitality' exceeds packet boundary");
|
|
|
|
// Validate field 'Energy' boundary
|
|
Assert.That(32 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Energy' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentHealth' boundary
|
|
Assert.That(34 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumHealth' boundary
|
|
Assert.That(36 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentMana' boundary
|
|
Assert.That(38 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentMana' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumMana' boundary
|
|
Assert.That(40 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumMana' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentShield' boundary
|
|
Assert.That(42 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentShield' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumShield' boundary
|
|
Assert.That(44 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumShield' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentAbility' boundary
|
|
Assert.That(46 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentAbility' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumAbility' boundary
|
|
Assert.That(48 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumAbility' exceeds packet boundary");
|
|
|
|
// Validate field 'Money' boundary
|
|
Assert.That(52 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Money' exceeds packet boundary");
|
|
|
|
// Validate field 'HeroState' boundary
|
|
Assert.That(56 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'HeroState' exceeds packet boundary");
|
|
|
|
// Validate field 'Status' boundary
|
|
Assert.That(57 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Status' exceeds packet boundary");
|
|
|
|
// Validate field 'UsedFruitPoints' boundary
|
|
Assert.That(58 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UsedFruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaxFruitPoints' boundary
|
|
Assert.That(60 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaxFruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'Leadership' boundary
|
|
Assert.That(62 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Leadership' exceeds packet boundary");
|
|
|
|
// Validate field 'UsedNegativeFruitPoints' boundary
|
|
Assert.That(64 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UsedNegativeFruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaxNegativeFruitPoints' boundary
|
|
Assert.That(66 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaxNegativeFruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'InventoryExtensions' boundary
|
|
Assert.That(68 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'InventoryExtensions' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterLevelUpdateExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterLevelUpdateExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 32;
|
|
var actualLength = CharacterLevelUpdateExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Level' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Level' exceeds packet boundary");
|
|
|
|
// Validate field 'LevelUpPoints' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'LevelUpPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumHealth' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumMana' boundary
|
|
Assert.That(12 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumMana' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumShield' boundary
|
|
Assert.That(16 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumShield' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumAbility' boundary
|
|
Assert.That(20 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumAbility' exceeds packet boundary");
|
|
|
|
// Validate field 'FruitPoints' boundary
|
|
Assert.That(24 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'FruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumFruitPoints' boundary
|
|
Assert.That(26 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumFruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'NegativeFruitPoints' boundary
|
|
Assert.That(28 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'NegativeFruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumNegativeFruitPoints' boundary
|
|
Assert.That(30 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumNegativeFruitPoints' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterInformationExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterInformationExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 92;
|
|
var actualLength = CharacterInformationExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'X' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'X' exceeds packet boundary");
|
|
|
|
// Validate field 'Y' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Y' exceeds packet boundary");
|
|
|
|
// Validate field 'MapId' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MapId' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentExperience' boundary
|
|
Assert.That(8 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentExperience' exceeds packet boundary");
|
|
|
|
// Validate field 'ExperienceForNextLevel' boundary
|
|
Assert.That(16 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ExperienceForNextLevel' exceeds packet boundary");
|
|
|
|
// Validate field 'LevelUpPoints' boundary
|
|
Assert.That(24 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'LevelUpPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'Strength' boundary
|
|
Assert.That(26 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Strength' exceeds packet boundary");
|
|
|
|
// Validate field 'Agility' boundary
|
|
Assert.That(28 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Agility' exceeds packet boundary");
|
|
|
|
// Validate field 'Vitality' boundary
|
|
Assert.That(30 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Vitality' exceeds packet boundary");
|
|
|
|
// Validate field 'Energy' boundary
|
|
Assert.That(32 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Energy' exceeds packet boundary");
|
|
|
|
// Validate field 'Leadership' boundary
|
|
Assert.That(34 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Leadership' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentHealth' boundary
|
|
Assert.That(36 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumHealth' boundary
|
|
Assert.That(40 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentMana' boundary
|
|
Assert.That(44 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentMana' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumMana' boundary
|
|
Assert.That(48 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumMana' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentShield' boundary
|
|
Assert.That(52 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentShield' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumShield' boundary
|
|
Assert.That(56 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumShield' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentAbility' boundary
|
|
Assert.That(60 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentAbility' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumAbility' boundary
|
|
Assert.That(64 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumAbility' exceeds packet boundary");
|
|
|
|
// Validate field 'Money' boundary
|
|
Assert.That(68 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Money' exceeds packet boundary");
|
|
|
|
// Validate field 'HeroState' boundary
|
|
Assert.That(72 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'HeroState' exceeds packet boundary");
|
|
|
|
// Validate field 'Status' boundary
|
|
Assert.That(73 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Status' exceeds packet boundary");
|
|
|
|
// Validate field 'UsedFruitPoints' boundary
|
|
Assert.That(74 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UsedFruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaxFruitPoints' boundary
|
|
Assert.That(76 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaxFruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'UsedNegativeFruitPoints' boundary
|
|
Assert.That(78 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UsedNegativeFruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaxNegativeFruitPoints' boundary
|
|
Assert.That(80 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaxNegativeFruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'AttackSpeed' boundary
|
|
Assert.That(82 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'AttackSpeed' exceeds packet boundary");
|
|
|
|
// Validate field 'MagicSpeed' boundary
|
|
Assert.That(84 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MagicSpeed' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumAttackSpeed' boundary
|
|
Assert.That(86 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumAttackSpeed' exceeds packet boundary");
|
|
|
|
// Validate field 'InventoryExtensions' boundary
|
|
Assert.That(88 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'InventoryExtensions' exceeds packet boundary");
|
|
|
|
// Validate field 'Resets' boundary
|
|
Assert.That(90 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Resets' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterInformation075.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterInformation075_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 42;
|
|
var actualLength = CharacterInformation075Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'X' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'X' exceeds packet boundary");
|
|
|
|
// Validate field 'Y' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Y' exceeds packet boundary");
|
|
|
|
// Validate field 'MapId' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MapId' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentExperience' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentExperience' exceeds packet boundary");
|
|
|
|
// Validate field 'ExperienceForNextLevel' boundary
|
|
Assert.That(12 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ExperienceForNextLevel' exceeds packet boundary");
|
|
|
|
// Validate field 'LevelUpPoints' boundary
|
|
Assert.That(16 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'LevelUpPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'Strength' boundary
|
|
Assert.That(18 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Strength' exceeds packet boundary");
|
|
|
|
// Validate field 'Agility' boundary
|
|
Assert.That(20 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Agility' exceeds packet boundary");
|
|
|
|
// Validate field 'Vitality' boundary
|
|
Assert.That(22 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Vitality' exceeds packet boundary");
|
|
|
|
// Validate field 'Energy' boundary
|
|
Assert.That(24 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Energy' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentHealth' boundary
|
|
Assert.That(26 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumHealth' boundary
|
|
Assert.That(28 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentMana' boundary
|
|
Assert.That(30 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentMana' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumMana' boundary
|
|
Assert.That(32 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumMana' exceeds packet boundary");
|
|
|
|
// Validate field 'Money' boundary
|
|
Assert.That(36 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Money' exceeds packet boundary");
|
|
|
|
// Validate field 'HeroState' boundary
|
|
Assert.That(40 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'HeroState' exceeds packet boundary");
|
|
|
|
// Validate field 'Status' boundary
|
|
Assert.That(41 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Status' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterInformation097.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterInformation097_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 52;
|
|
var actualLength = CharacterInformation097Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'X' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'X' exceeds packet boundary");
|
|
|
|
// Validate field 'Y' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Y' exceeds packet boundary");
|
|
|
|
// Validate field 'MapId' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MapId' exceeds packet boundary");
|
|
|
|
// Validate field 'Direction' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Direction' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentExperience' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentExperience' exceeds packet boundary");
|
|
|
|
// Validate field 'ExperienceForNextLevel' boundary
|
|
Assert.That(12 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ExperienceForNextLevel' exceeds packet boundary");
|
|
|
|
// Validate field 'LevelUpPoints' boundary
|
|
Assert.That(16 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'LevelUpPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'Strength' boundary
|
|
Assert.That(18 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Strength' exceeds packet boundary");
|
|
|
|
// Validate field 'Agility' boundary
|
|
Assert.That(20 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Agility' exceeds packet boundary");
|
|
|
|
// Validate field 'Vitality' boundary
|
|
Assert.That(22 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Vitality' exceeds packet boundary");
|
|
|
|
// Validate field 'Energy' boundary
|
|
Assert.That(24 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Energy' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentHealth' boundary
|
|
Assert.That(26 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumHealth' boundary
|
|
Assert.That(28 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentMana' boundary
|
|
Assert.That(30 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentMana' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumMana' boundary
|
|
Assert.That(32 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumMana' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentAbility' boundary
|
|
Assert.That(34 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentAbility' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumAbility' boundary
|
|
Assert.That(36 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumAbility' exceeds packet boundary");
|
|
|
|
// Validate field 'Money' boundary
|
|
Assert.That(40 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Money' exceeds packet boundary");
|
|
|
|
// Validate field 'HeroState' boundary
|
|
Assert.That(44 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'HeroState' exceeds packet boundary");
|
|
|
|
// Validate field 'Status' boundary
|
|
Assert.That(45 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Status' exceeds packet boundary");
|
|
|
|
// Validate field 'UsedFruitPoints' boundary
|
|
Assert.That(46 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UsedFruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaxFruitPoints' boundary
|
|
Assert.That(48 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaxFruitPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'Leadership' boundary
|
|
Assert.That(50 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Leadership' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CharacterInventory.
|
|
/// </summary>
|
|
[Test]
|
|
public void CharacterInventory_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'ItemCount' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'ItemCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for InventoryItemUpgraded.
|
|
/// </summary>
|
|
[Test]
|
|
public void InventoryItemUpgraded_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = InventoryItemUpgradedRef.GetRequiredSize(testBinaryLength);
|
|
var expectedMinSize = testBinaryLength + 5;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for SummonHealthUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void SummonHealthUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = SummonHealthUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'HealthPercent' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'HealthPercent' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildSoccerTimeUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildSoccerTimeUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 6;
|
|
var actualLength = GuildSoccerTimeUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Seconds' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Seconds' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildSoccerScoreUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildSoccerScoreUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 22;
|
|
var actualLength = GuildSoccerScoreUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'RedTeamName' boundary
|
|
Assert.That(4 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RedTeamName' exceeds packet boundary");
|
|
|
|
// Validate field 'RedTeamGoals' boundary
|
|
Assert.That(12 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RedTeamGoals' exceeds packet boundary");
|
|
|
|
// Validate field 'BlueTeamName' boundary
|
|
Assert.That(13 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'BlueTeamName' exceeds packet boundary");
|
|
|
|
// Validate field 'BlueTeamGoals' boundary
|
|
Assert.That(21 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'BlueTeamGoals' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ServerCommand.
|
|
/// </summary>
|
|
[Test]
|
|
public void ServerCommand_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = ServerCommandRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'CommandType' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CommandType' exceeds packet boundary");
|
|
|
|
// Validate field 'Parameter1' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Parameter1' exceeds packet boundary");
|
|
|
|
// Validate field 'Parameter2' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Parameter2' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ShowFireworks.
|
|
/// </summary>
|
|
[Test]
|
|
public void ShowFireworks_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = ShowFireworksRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'EffectType' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'EffectType' exceeds packet boundary");
|
|
|
|
// Validate field 'X' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'X' exceeds packet boundary");
|
|
|
|
// Validate field 'Y' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Y' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ShowChristmasFireworks.
|
|
/// </summary>
|
|
[Test]
|
|
public void ShowChristmasFireworks_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = ShowChristmasFireworksRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'EffectType' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'EffectType' exceeds packet boundary");
|
|
|
|
// Validate field 'X' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'X' exceeds packet boundary");
|
|
|
|
// Validate field 'Y' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Y' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PlayFanfareSound.
|
|
/// </summary>
|
|
[Test]
|
|
public void PlayFanfareSound_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = PlayFanfareSoundRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'EffectType' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'EffectType' exceeds packet boundary");
|
|
|
|
// Validate field 'X' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'X' exceeds packet boundary");
|
|
|
|
// Validate field 'Y' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Y' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ShowSwirl.
|
|
/// </summary>
|
|
[Test]
|
|
public void ShowSwirl_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = ShowSwirlRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'EffectType' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'EffectType' exceeds packet boundary");
|
|
|
|
// Validate field 'TargetObjectId' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TargetObjectId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MasterStatsUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void MasterStatsUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 32;
|
|
var actualLength = MasterStatsUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'MasterLevel' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MasterLevel' exceeds packet boundary");
|
|
|
|
// Validate field 'MasterExperience' boundary
|
|
Assert.That(6 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MasterExperience' exceeds packet boundary");
|
|
|
|
// Validate field 'MasterExperienceOfNextLevel' boundary
|
|
Assert.That(14 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MasterExperienceOfNextLevel' exceeds packet boundary");
|
|
|
|
// Validate field 'MasterLevelUpPoints' boundary
|
|
Assert.That(22 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MasterLevelUpPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumHealth' boundary
|
|
Assert.That(24 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumMana' boundary
|
|
Assert.That(26 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumMana' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumShield' boundary
|
|
Assert.That(28 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumShield' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumAbility' boundary
|
|
Assert.That(30 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumAbility' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MasterStatsUpdateExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void MasterStatsUpdateExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 40;
|
|
var actualLength = MasterStatsUpdateExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'MasterLevel' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MasterLevel' exceeds packet boundary");
|
|
|
|
// Validate field 'MasterExperience' boundary
|
|
Assert.That(6 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MasterExperience' exceeds packet boundary");
|
|
|
|
// Validate field 'MasterExperienceOfNextLevel' boundary
|
|
Assert.That(14 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MasterExperienceOfNextLevel' exceeds packet boundary");
|
|
|
|
// Validate field 'MasterLevelUpPoints' boundary
|
|
Assert.That(22 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MasterLevelUpPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumHealth' boundary
|
|
Assert.That(24 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumMana' boundary
|
|
Assert.That(28 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumMana' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumShield' boundary
|
|
Assert.That(32 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumShield' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumAbility' boundary
|
|
Assert.That(36 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumAbility' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MasterCharacterLevelUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void MasterCharacterLevelUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 20;
|
|
var actualLength = MasterCharacterLevelUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'MasterLevel' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MasterLevel' exceeds packet boundary");
|
|
|
|
// Validate field 'GainedMasterPoints' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'GainedMasterPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentMasterPoints' boundary
|
|
Assert.That(8 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentMasterPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumMasterPoints' boundary
|
|
Assert.That(10 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumMasterPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumHealth' boundary
|
|
Assert.That(12 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumMana' boundary
|
|
Assert.That(14 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumMana' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumShield' boundary
|
|
Assert.That(16 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumShield' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumAbility' boundary
|
|
Assert.That(18 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumAbility' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MasterCharacterLevelUpdateExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void MasterCharacterLevelUpdateExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 28;
|
|
var actualLength = MasterCharacterLevelUpdateExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'MasterLevel' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MasterLevel' exceeds packet boundary");
|
|
|
|
// Validate field 'GainedMasterPoints' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'GainedMasterPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'CurrentMasterPoints' boundary
|
|
Assert.That(8 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurrentMasterPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumMasterPoints' boundary
|
|
Assert.That(10 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumMasterPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumHealth' boundary
|
|
Assert.That(12 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumHealth' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumMana' boundary
|
|
Assert.That(16 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumMana' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumShield' boundary
|
|
Assert.That(20 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumShield' exceeds packet boundary");
|
|
|
|
// Validate field 'MaximumAbility' boundary
|
|
Assert.That(24 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaximumAbility' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MasterSkillLevelUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void MasterSkillLevelUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 28;
|
|
var actualLength = MasterSkillLevelUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Success' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Success' exceeds packet boundary");
|
|
|
|
// Validate field 'MasterLevelUpPoints' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MasterLevelUpPoints' exceeds packet boundary");
|
|
|
|
// Validate field 'MasterSkillIndex' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MasterSkillIndex' exceeds packet boundary");
|
|
|
|
// Validate field 'MasterSkillNumber' boundary
|
|
Assert.That(12 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MasterSkillNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'Level' boundary
|
|
Assert.That(16 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Level' exceeds packet boundary");
|
|
|
|
// Validate field 'DisplayValue' boundary
|
|
Assert.That(20 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'DisplayValue' exceeds packet boundary");
|
|
|
|
// Validate field 'DisplayValueOfNextLevel' boundary
|
|
Assert.That(24 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'DisplayValueOfNextLevel' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MasterSkillList.
|
|
/// </summary>
|
|
[Test]
|
|
public void MasterSkillList_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'MasterSkillCount' starts at index 8 with size 4
|
|
Assert.That(8, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'MasterSkillCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ServerMessage.
|
|
/// </summary>
|
|
[Test]
|
|
public void ServerMessage_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const string testString = "TestData";
|
|
var calculatedSize = ServerMessageRef.GetRequiredSize(testString);
|
|
var expectedMinSize = Encoding.UTF8.GetByteCount(testString) + 1 + 4;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for string field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildJoinRequest.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildJoinRequest_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = GuildJoinRequestRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'RequesterId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RequesterId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildJoinResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildJoinResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = GuildJoinResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildList.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildList_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'IsInGuild' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'IsInGuild' has invalid negative index");
|
|
|
|
// Field 'GuildMemberCount' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'GuildMemberCount' has invalid negative index");
|
|
|
|
// Field 'TotalScore' starts at index 8 with size 4
|
|
Assert.That(8, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'TotalScore' has invalid negative index");
|
|
|
|
// Field 'CurrentScore' starts at index 12 with size 1
|
|
Assert.That(12, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'CurrentScore' has invalid negative index");
|
|
|
|
// Field 'RivalGuildName' starts at index 13 with size 8
|
|
Assert.That(13, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'RivalGuildName' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildList075.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildList075_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'IsInGuild' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'IsInGuild' has invalid negative index");
|
|
|
|
// Field 'GuildMemberCount' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'GuildMemberCount' has invalid negative index");
|
|
|
|
// Field 'TotalScore' starts at index 8 with size 4
|
|
Assert.That(8, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'TotalScore' has invalid negative index");
|
|
|
|
// Field 'CurrentScore' starts at index 12 with size 1
|
|
Assert.That(12, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'CurrentScore' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildKickResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildKickResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = GuildKickResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ShowGuildMasterDialog.
|
|
/// </summary>
|
|
[Test]
|
|
public void ShowGuildMasterDialog_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 3;
|
|
var actualLength = ShowGuildMasterDialogRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ShowGuildCreationDialog.
|
|
/// </summary>
|
|
[Test]
|
|
public void ShowGuildCreationDialog_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 3;
|
|
var actualLength = ShowGuildCreationDialogRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildCreationResult.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildCreationResult_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = GuildCreationResultRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Success' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Success' exceeds packet boundary");
|
|
|
|
// Validate field 'Error' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Error' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildMemberLeftGuild.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildMemberLeftGuild_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = GuildMemberLeftGuildRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'PlayerId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PlayerId' exceeds packet boundary");
|
|
|
|
// Validate field 'IsGuildMaster' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsGuildMaster' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildWarRequestResult.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildWarRequestResult_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = GuildWarRequestResultRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildWarRequest.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildWarRequest_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 12;
|
|
var actualLength = GuildWarRequestRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'GuildName' boundary
|
|
Assert.That(3 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'GuildName' exceeds packet boundary");
|
|
|
|
// Validate field 'Type' boundary
|
|
Assert.That(11 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Type' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildWarDeclared.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildWarDeclared_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 13;
|
|
var actualLength = GuildWarDeclaredRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'GuildName' boundary
|
|
Assert.That(3 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'GuildName' exceeds packet boundary");
|
|
|
|
// Validate field 'Type' boundary
|
|
Assert.That(11 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Type' exceeds packet boundary");
|
|
|
|
// Validate field 'TeamCode' boundary
|
|
Assert.That(12 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TeamCode' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildWarEnded.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildWarEnded_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 12;
|
|
var actualLength = GuildWarEndedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
|
|
// Validate field 'GuildName' boundary
|
|
Assert.That(4 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'GuildName' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildWarScoreUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildWarScoreUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 6;
|
|
var actualLength = GuildWarScoreUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'ScoreOfOwnGuild' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ScoreOfOwnGuild' exceeds packet boundary");
|
|
|
|
// Validate field 'ScoreOfEnemyGuild' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ScoreOfEnemyGuild' exceeds packet boundary");
|
|
|
|
// Validate field 'Type' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Type' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildRelationshipRequest.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildRelationshipRequest_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = GuildRelationshipRequestRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'RelationshipType' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RelationshipType' exceeds packet boundary");
|
|
|
|
// Validate field 'RequestType' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RequestType' exceeds packet boundary");
|
|
|
|
// Validate field 'SenderId' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SenderId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildRelationshipChangeResult.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildRelationshipChangeResult_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = GuildRelationshipChangeResultRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'RelationshipType' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RelationshipType' exceeds packet boundary");
|
|
|
|
// Validate field 'RequestType' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RequestType' exceeds packet boundary");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
|
|
// Validate field 'GuildMasterId' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'GuildMasterId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AllianceList.
|
|
/// </summary>
|
|
[Test]
|
|
public void AllianceList_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'GuildCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'GuildCount' has invalid negative index");
|
|
|
|
// Field 'Success' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Success' has invalid negative index");
|
|
|
|
// Field '__RivalCount' starts at index 6 with size 1
|
|
Assert.That(6, Is.GreaterThanOrEqualTo(0),
|
|
"Field '__RivalCount' has invalid negative index");
|
|
|
|
// Field '__UnionCount' starts at index 7 with size 1
|
|
Assert.That(7, Is.GreaterThanOrEqualTo(0),
|
|
"Field '__UnionCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for RemoveAllianceGuildResult.
|
|
/// </summary>
|
|
[Test]
|
|
public void RemoveAllianceGuildResult_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = RemoveAllianceGuildResultRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
|
|
// Validate field 'RequestType' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RequestType' exceeds packet boundary");
|
|
|
|
// Validate field 'RelationshipType' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RelationshipType' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AssignCharacterToGuild.
|
|
/// </summary>
|
|
[Test]
|
|
public void AssignCharacterToGuild_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'PlayerCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'PlayerCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AssignCharacterToGuild075.
|
|
/// </summary>
|
|
[Test]
|
|
public void AssignCharacterToGuild075_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'PlayerCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'PlayerCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildInformation.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildInformation_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 60;
|
|
var actualLength = GuildInformationRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'GuildId' boundary
|
|
Assert.That(4 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'GuildId' exceeds packet boundary");
|
|
|
|
// Validate field 'GuildType' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'GuildType' exceeds packet boundary");
|
|
|
|
// Validate field 'AllianceGuildName' boundary
|
|
Assert.That(9 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'AllianceGuildName' exceeds packet boundary");
|
|
|
|
// Validate field 'GuildName' boundary
|
|
Assert.That(17 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'GuildName' exceeds packet boundary");
|
|
|
|
// Validate field 'Logo' boundary
|
|
Assert.That(25 + 32, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Logo' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for GuildInformations075.
|
|
/// </summary>
|
|
[Test]
|
|
public void GuildInformations075_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'GuildCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'GuildCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for SingleGuildInformation075.
|
|
/// </summary>
|
|
[Test]
|
|
public void SingleGuildInformation075_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 45;
|
|
var actualLength = SingleGuildInformation075Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'GuildId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'GuildId' exceeds packet boundary");
|
|
|
|
// Validate field 'GuildName' boundary
|
|
Assert.That(5 + 8, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'GuildName' exceeds packet boundary");
|
|
|
|
// Validate field 'Logo' boundary
|
|
Assert.That(13 + 32, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Logo' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for VaultMoneyUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void VaultMoneyUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 12;
|
|
var actualLength = VaultMoneyUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Success' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Success' exceeds packet boundary");
|
|
|
|
// Validate field 'VaultMoney' boundary
|
|
Assert.That(4 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'VaultMoney' exceeds packet boundary");
|
|
|
|
// Validate field 'InventoryMoney' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'InventoryMoney' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for VaultClosed.
|
|
/// </summary>
|
|
[Test]
|
|
public void VaultClosed_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 3;
|
|
var actualLength = VaultClosedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for VaultProtectionInformation.
|
|
/// </summary>
|
|
[Test]
|
|
public void VaultProtectionInformation_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = VaultProtectionInformationRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'ProtectionState' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ProtectionState' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ItemCraftingResult.
|
|
/// </summary>
|
|
[Test]
|
|
public void ItemCraftingResult_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const int testBinaryLength = 10;
|
|
var calculatedSize = ItemCraftingResultRef.GetRequiredSize(testBinaryLength);
|
|
var expectedMinSize = testBinaryLength + 4;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for binary field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for CraftingDialogClosed075.
|
|
/// </summary>
|
|
[Test]
|
|
public void CraftingDialogClosed075_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 3;
|
|
var actualLength = CraftingDialogClosed075Ref.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for LegacyQuestStateList.
|
|
/// </summary>
|
|
[Test]
|
|
public void LegacyQuestStateList_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'QuestCount' starts at index 3 with size 1
|
|
Assert.That(3, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'QuestCount' has invalid negative index");
|
|
|
|
// Field 'ScrollOfEmperorState' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'ScrollOfEmperorState' has invalid negative index");
|
|
|
|
// Field 'ThreeTreasuresOfMuState' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'ThreeTreasuresOfMuState' has invalid negative index");
|
|
|
|
// Field 'GainHeroStatusState' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'GainHeroStatusState' has invalid negative index");
|
|
|
|
// Field 'SecretOfDarkStoneState' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'SecretOfDarkStoneState' has invalid negative index");
|
|
|
|
// Field 'CertificateOfStrengthState' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'CertificateOfStrengthState' has invalid negative index");
|
|
|
|
// Field 'InfiltrationOfBarrackState' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'InfiltrationOfBarrackState' has invalid negative index");
|
|
|
|
// Field 'InfiltrationOfRefugeState' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'InfiltrationOfRefugeState' has invalid negative index");
|
|
|
|
// Field 'UnusedQuestState' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'UnusedQuestState' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for LegacyQuestStateDialog.
|
|
/// </summary>
|
|
[Test]
|
|
public void LegacyQuestStateDialog_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = LegacyQuestStateDialogRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'QuestIndex' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestIndex' exceeds packet boundary");
|
|
|
|
// Validate field 'State' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'State' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for LegacySetQuestStateResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void LegacySetQuestStateResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 6;
|
|
var actualLength = LegacySetQuestStateResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'QuestIndex' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestIndex' exceeds packet boundary");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
|
|
// Validate field 'NewState' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'NewState' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for LegacyQuestReward.
|
|
/// </summary>
|
|
[Test]
|
|
public void LegacyQuestReward_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = LegacyQuestRewardRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'PlayerId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PlayerId' exceeds packet boundary");
|
|
|
|
// Validate field 'Reward' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Reward' exceeds packet boundary");
|
|
|
|
// Validate field 'Count' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Count' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for LegacyQuestMonsterKillInfo.
|
|
/// </summary>
|
|
[Test]
|
|
public void LegacyQuestMonsterKillInfo_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 48;
|
|
var actualLength = LegacyQuestMonsterKillInfoRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
|
|
// Validate field 'QuestIndex' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestIndex' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PetMode.
|
|
/// </summary>
|
|
[Test]
|
|
public void PetMode_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = PetModeRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Pet' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Pet' exceeds packet boundary");
|
|
|
|
// Validate field 'PetCommandMode' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PetCommandMode' exceeds packet boundary");
|
|
|
|
// Validate field 'TargetId' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TargetId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PetAttack.
|
|
/// </summary>
|
|
[Test]
|
|
public void PetAttack_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 9;
|
|
var actualLength = PetAttackRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Pet' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Pet' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillType' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillType' exceeds packet boundary");
|
|
|
|
// Validate field 'OwnerId' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'OwnerId' exceeds packet boundary");
|
|
|
|
// Validate field 'TargetId' boundary
|
|
Assert.That(7 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TargetId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for PetInfoResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void PetInfoResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 13;
|
|
var actualLength = PetInfoResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Pet' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Pet' exceeds packet boundary");
|
|
|
|
// Validate field 'Storage' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Storage' exceeds packet boundary");
|
|
|
|
// Validate field 'ItemSlot' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ItemSlot' exceeds packet boundary");
|
|
|
|
// Validate field 'Level' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Level' exceeds packet boundary");
|
|
|
|
// Validate field 'Experience' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Experience' exceeds packet boundary");
|
|
|
|
// Validate field 'Health' boundary
|
|
Assert.That(12 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Health' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for DuelStartResult.
|
|
/// </summary>
|
|
[Test]
|
|
public void DuelStartResult_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 17;
|
|
var actualLength = DuelStartResultRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
|
|
// Validate field 'OpponentId' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'OpponentId' exceeds packet boundary");
|
|
|
|
// Validate field 'OpponentName' boundary
|
|
Assert.That(7 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'OpponentName' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for DuelStartRequest.
|
|
/// </summary>
|
|
[Test]
|
|
public void DuelStartRequest_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 16;
|
|
var actualLength = DuelStartRequestRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'RequesterId' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RequesterId' exceeds packet boundary");
|
|
|
|
// Validate field 'RequesterName' boundary
|
|
Assert.That(6 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RequesterName' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for DuelEnd.
|
|
/// </summary>
|
|
[Test]
|
|
public void DuelEnd_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 17;
|
|
var actualLength = DuelEndRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
|
|
// Validate field 'OpponentId' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'OpponentId' exceeds packet boundary");
|
|
|
|
// Validate field 'OpponentName' boundary
|
|
Assert.That(7 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'OpponentName' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for DuelScore.
|
|
/// </summary>
|
|
[Test]
|
|
public void DuelScore_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 10;
|
|
var actualLength = DuelScoreRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Player1Id' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Player1Id' exceeds packet boundary");
|
|
|
|
// Validate field 'Player2Id' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Player2Id' exceeds packet boundary");
|
|
|
|
// Validate field 'Player1Score' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Player1Score' exceeds packet boundary");
|
|
|
|
// Validate field 'Player2Score' boundary
|
|
Assert.That(9 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Player2Score' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for DuelHealthUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void DuelHealthUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 12;
|
|
var actualLength = DuelHealthUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Player1Id' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Player1Id' exceeds packet boundary");
|
|
|
|
// Validate field 'Player2Id' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Player2Id' exceeds packet boundary");
|
|
|
|
// Validate field 'Player1HealthPercentage' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Player1HealthPercentage' exceeds packet boundary");
|
|
|
|
// Validate field 'Player2HealthPercentage' boundary
|
|
Assert.That(9 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Player2HealthPercentage' exceeds packet boundary");
|
|
|
|
// Validate field 'Player1ShieldPercentage' boundary
|
|
Assert.That(10 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Player1ShieldPercentage' exceeds packet boundary");
|
|
|
|
// Validate field 'Player2ShieldPercentage' boundary
|
|
Assert.That(11 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Player2ShieldPercentage' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for DuelStatus.
|
|
/// </summary>
|
|
[Test]
|
|
public void DuelStatus_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 92;
|
|
var actualLength = DuelStatusRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for DuelInit.
|
|
/// </summary>
|
|
[Test]
|
|
public void DuelInit_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 30;
|
|
var actualLength = DuelInitRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
|
|
// Validate field 'RoomIndex' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RoomIndex' exceeds packet boundary");
|
|
|
|
// Validate field 'Player1Name' boundary
|
|
Assert.That(6 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Player1Name' exceeds packet boundary");
|
|
|
|
// Validate field 'Player2Name' boundary
|
|
Assert.That(16 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Player2Name' exceeds packet boundary");
|
|
|
|
// Validate field 'Player1Id' boundary
|
|
Assert.That(26 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Player1Id' exceeds packet boundary");
|
|
|
|
// Validate field 'Player2Id' boundary
|
|
Assert.That(28 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Player2Id' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for DuelHealthBarInit.
|
|
/// </summary>
|
|
[Test]
|
|
public void DuelHealthBarInit_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = DuelHealthBarInitRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for DuelSpectatorAdded.
|
|
/// </summary>
|
|
[Test]
|
|
public void DuelSpectatorAdded_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 14;
|
|
var actualLength = DuelSpectatorAddedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Name' boundary
|
|
Assert.That(4 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Name' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for DuelSpectatorRemoved.
|
|
/// </summary>
|
|
[Test]
|
|
public void DuelSpectatorRemoved_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 14;
|
|
var actualLength = DuelSpectatorRemovedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Name' boundary
|
|
Assert.That(4 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Name' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for DuelSpectatorList.
|
|
/// </summary>
|
|
[Test]
|
|
public void DuelSpectatorList_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 105;
|
|
var actualLength = DuelSpectatorListRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Count' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Count' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for DuelFinished.
|
|
/// </summary>
|
|
[Test]
|
|
public void DuelFinished_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 24;
|
|
var actualLength = DuelFinishedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Winner' boundary
|
|
Assert.That(4 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Winner' exceeds packet boundary");
|
|
|
|
// Validate field 'Loser' boundary
|
|
Assert.That(14 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Loser' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for SkillStageUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void SkillStageUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = SkillStageUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'ObjectId' boundary
|
|
Assert.That(3 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ObjectId' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillNumber' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'Stage' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Stage' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for IllusionTempleEnterResult.
|
|
/// </summary>
|
|
[Test]
|
|
public void IllusionTempleEnterResult_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = IllusionTempleEnterResultRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for IllusionTempleState.
|
|
/// </summary>
|
|
[Test]
|
|
public void IllusionTempleState_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'RemainingSeconds' starts at index 4 with size 2
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'RemainingSeconds' has invalid negative index");
|
|
|
|
// Field 'PlayerIndex' starts at index 4 with size 2
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'PlayerIndex' has invalid negative index");
|
|
|
|
// Field 'PositionX' starts at index 6 with size 1
|
|
Assert.That(6, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'PositionX' has invalid negative index");
|
|
|
|
// Field 'PositionY' starts at index 7 with size 1
|
|
Assert.That(7, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'PositionY' has invalid negative index");
|
|
|
|
// Field 'Team1Points' starts at index 8 with size 1
|
|
Assert.That(8, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Team1Points' has invalid negative index");
|
|
|
|
// Field 'Team2Points' starts at index 9 with size 1
|
|
Assert.That(9, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Team2Points' has invalid negative index");
|
|
|
|
// Field 'MyTeam' starts at index 10 with size 1
|
|
Assert.That(10, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'MyTeam' has invalid negative index");
|
|
|
|
// Field 'PartyCount' starts at index 11 with size 1
|
|
Assert.That(11, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'PartyCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for IllusionTempleSkillUsageResult.
|
|
/// </summary>
|
|
[Test]
|
|
public void IllusionTempleSkillUsageResult_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 11;
|
|
var actualLength = IllusionTempleSkillUsageResultRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
|
|
// Validate field 'SkillNumber' boundary
|
|
Assert.That(5 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'SourceObjectId' boundary
|
|
Assert.That(7 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SourceObjectId' exceeds packet boundary");
|
|
|
|
// Validate field 'TargetObjectId' boundary
|
|
Assert.That(9 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TargetObjectId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for IllusionTempleUserCount.
|
|
/// </summary>
|
|
[Test]
|
|
public void IllusionTempleUserCount_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 10;
|
|
var actualLength = IllusionTempleUserCountRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'UserCount1' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UserCount1' exceeds packet boundary");
|
|
|
|
// Validate field 'UserCount2' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UserCount2' exceeds packet boundary");
|
|
|
|
// Validate field 'UserCount3' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UserCount3' exceeds packet boundary");
|
|
|
|
// Validate field 'UserCount4' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UserCount4' exceeds packet boundary");
|
|
|
|
// Validate field 'UserCount5' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UserCount5' exceeds packet boundary");
|
|
|
|
// Validate field 'UserCount6' boundary
|
|
Assert.That(9 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UserCount6' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for IllusionTempleResult.
|
|
/// </summary>
|
|
[Test]
|
|
public void IllusionTempleResult_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'Team1Points' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Team1Points' has invalid negative index");
|
|
|
|
// Field 'Team2Points' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Team2Points' has invalid negative index");
|
|
|
|
// Field 'PlayerCount' starts at index 6 with size 1
|
|
Assert.That(6, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'PlayerCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for IllusionTempleSkillPointUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void IllusionTempleSkillPointUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = IllusionTempleSkillPointUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'SkillPoints' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillPoints' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for IllusionTempleSkillEnded.
|
|
/// </summary>
|
|
[Test]
|
|
public void IllusionTempleSkillEnded_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = IllusionTempleSkillEndedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'SkillNumber' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SkillNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'ObjectIndex' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ObjectIndex' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for IllusionTempleHolyItemRelics.
|
|
/// </summary>
|
|
[Test]
|
|
public void IllusionTempleHolyItemRelics_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const string testString = "TestData";
|
|
var calculatedSize = IllusionTempleHolyItemRelicsRef.GetRequiredSize(testString);
|
|
var expectedMinSize = Encoding.UTF8.GetByteCount(testString) + 1 + 6;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for string field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for IllusionTempleSkillEnd.
|
|
/// </summary>
|
|
[Test]
|
|
public void IllusionTempleSkillEnd_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 6;
|
|
var actualLength = IllusionTempleSkillEndRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'TempleNumber' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TempleNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'State' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'State' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ChainLightningHitInfo.
|
|
/// </summary>
|
|
[Test]
|
|
public void ChainLightningHitInfo_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'SkillNumber' starts at index 4 with size 2
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'SkillNumber' has invalid negative index");
|
|
|
|
// Field 'PlayerId' starts at index 6 with size 2
|
|
Assert.That(6, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'PlayerId' has invalid negative index");
|
|
|
|
// Field 'TargetCount' starts at index 8 with size 1
|
|
Assert.That(8, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'TargetCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MuHelperStatusUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void MuHelperStatusUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 16;
|
|
var actualLength = MuHelperStatusUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'ConsumeMoney' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ConsumeMoney' exceeds packet boundary");
|
|
|
|
// Validate field 'Money' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Money' exceeds packet boundary");
|
|
|
|
// Validate field 'PauseStatus' boundary
|
|
Assert.That(12 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PauseStatus' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MuHelperConfigurationData.
|
|
/// </summary>
|
|
[Test]
|
|
public void MuHelperConfigurationData_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 261;
|
|
var actualLength = MuHelperConfigurationDataRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'HelperData' boundary
|
|
Assert.That(4 + 257, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'HelperData' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MessengerInitialization.
|
|
/// </summary>
|
|
[Test]
|
|
public void MessengerInitialization_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'LetterCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'LetterCount' has invalid negative index");
|
|
|
|
// Field 'MaximumLetterCount' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'MaximumLetterCount' has invalid negative index");
|
|
|
|
// Field 'FriendCount' starts at index 6 with size 1
|
|
Assert.That(6, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'FriendCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for FriendAdded.
|
|
/// </summary>
|
|
[Test]
|
|
public void FriendAdded_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 15;
|
|
var actualLength = FriendAddedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'FriendName' boundary
|
|
Assert.That(4 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'FriendName' exceeds packet boundary");
|
|
|
|
// Validate field 'ServerId' boundary
|
|
Assert.That(14 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ServerId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for FriendRequest.
|
|
/// </summary>
|
|
[Test]
|
|
public void FriendRequest_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 13;
|
|
var actualLength = FriendRequestRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Requester' boundary
|
|
Assert.That(3 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Requester' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for FriendDeleted.
|
|
/// </summary>
|
|
[Test]
|
|
public void FriendDeleted_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 14;
|
|
var actualLength = FriendDeletedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'FriendName' boundary
|
|
Assert.That(4 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'FriendName' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for FriendOnlineStateUpdate.
|
|
/// </summary>
|
|
[Test]
|
|
public void FriendOnlineStateUpdate_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 14;
|
|
var actualLength = FriendOnlineStateUpdateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'FriendName' boundary
|
|
Assert.That(3 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'FriendName' exceeds packet boundary");
|
|
|
|
// Validate field 'ServerId' boundary
|
|
Assert.That(13 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ServerId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for LetterSendResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void LetterSendResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = LetterSendResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'LetterId' boundary
|
|
Assert.That(4 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'LetterId' exceeds packet boundary");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AddLetter.
|
|
/// </summary>
|
|
[Test]
|
|
public void AddLetter_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 79;
|
|
var actualLength = AddLetterRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'LetterIndex' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'LetterIndex' exceeds packet boundary");
|
|
|
|
// Validate field 'SenderName' boundary
|
|
Assert.That(6 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'SenderName' exceeds packet boundary");
|
|
|
|
// Validate field 'Timestamp' boundary
|
|
Assert.That(16 + 30, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Timestamp' exceeds packet boundary");
|
|
|
|
// Validate field 'Subject' boundary
|
|
Assert.That(46 + 32, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Subject' exceeds packet boundary");
|
|
|
|
// Validate field 'State' boundary
|
|
Assert.That(78 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'State' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for OpenLetter.
|
|
/// </summary>
|
|
[Test]
|
|
public void OpenLetter_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const string testString = "TestData";
|
|
var calculatedSize = OpenLetterRef.GetRequiredSize(testString);
|
|
var expectedMinSize = Encoding.UTF8.GetByteCount(testString) + 1 + 28;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for string field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for OpenLetterExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void OpenLetterExtended_PacketSizeValidation()
|
|
{
|
|
// Variable-length packet validation
|
|
// Test GetRequiredSize method with sample data
|
|
const string testString = "TestData";
|
|
var calculatedSize = OpenLetterExtendedRef.GetRequiredSize(testString);
|
|
var expectedMinSize = Encoding.UTF8.GetByteCount(testString) + 1 + 50;
|
|
|
|
Assert.That(calculatedSize, Is.GreaterThanOrEqualTo(expectedMinSize),
|
|
"GetRequiredSize calculation incorrect for string field");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for RemoveLetter.
|
|
/// </summary>
|
|
[Test]
|
|
public void RemoveLetter_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 6;
|
|
var actualLength = RemoveLetterRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'RequestSuccessful' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RequestSuccessful' exceeds packet boundary");
|
|
|
|
// Validate field 'LetterIndex' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'LetterIndex' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ChatRoomConnectionInfo.
|
|
/// </summary>
|
|
[Test]
|
|
public void ChatRoomConnectionInfo_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 36;
|
|
var actualLength = ChatRoomConnectionInfoRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'ChatServerIp' boundary
|
|
Assert.That(3 + 15, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ChatServerIp' exceeds packet boundary");
|
|
|
|
// Validate field 'ChatRoomId' boundary
|
|
Assert.That(18 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ChatRoomId' exceeds packet boundary");
|
|
|
|
// Validate field 'AuthenticationToken' boundary
|
|
Assert.That(20 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'AuthenticationToken' exceeds packet boundary");
|
|
|
|
// Validate field 'Type' boundary
|
|
Assert.That(24 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Type' exceeds packet boundary");
|
|
|
|
// Validate field 'FriendName' boundary
|
|
Assert.That(25 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'FriendName' exceeds packet boundary");
|
|
|
|
// Validate field 'Success' boundary
|
|
Assert.That(35 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Success' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for FriendInvitationResult.
|
|
/// </summary>
|
|
[Test]
|
|
public void FriendInvitationResult_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = FriendInvitationResultRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Success' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Success' exceeds packet boundary");
|
|
|
|
// Validate field 'RequestId' boundary
|
|
Assert.That(4 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RequestId' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for QuestEventResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void QuestEventResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 12;
|
|
var actualLength = QuestEventResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AvailableQuests.
|
|
/// </summary>
|
|
[Test]
|
|
public void AvailableQuests_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'QuestNpcNumber' starts at index 4 with size 2
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'QuestNpcNumber' has invalid negative index");
|
|
|
|
// Field 'QuestCount' starts at index 6 with size 2
|
|
Assert.That(6, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'QuestCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for QuestStepInfo.
|
|
/// </summary>
|
|
[Test]
|
|
public void QuestStepInfo_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 11;
|
|
var actualLength = QuestStepInfoRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'QuestStepNumber' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestStepNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'QuestGroup' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestGroup' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for QuestProgress.
|
|
/// </summary>
|
|
[Test]
|
|
public void QuestProgress_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 251;
|
|
var actualLength = QuestProgressRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'QuestNumber' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'QuestGroup' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestGroup' exceeds packet boundary");
|
|
|
|
// Validate field 'ConditionCount' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ConditionCount' exceeds packet boundary");
|
|
|
|
// Validate field 'RewardCount' boundary
|
|
Assert.That(9 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RewardCount' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for QuestProgressExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void QuestProgressExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 272;
|
|
var actualLength = QuestProgressExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'ConditionCount' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ConditionCount' exceeds packet boundary");
|
|
|
|
// Validate field 'RewardCount' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RewardCount' exceeds packet boundary");
|
|
|
|
// Validate field 'RandomRewardCount' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RandomRewardCount' exceeds packet boundary");
|
|
|
|
// Validate field 'QuestNumber' boundary
|
|
Assert.That(8 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'QuestGroup' boundary
|
|
Assert.That(10 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestGroup' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for QuestCompletionResponse.
|
|
/// </summary>
|
|
[Test]
|
|
public void QuestCompletionResponse_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 9;
|
|
var actualLength = QuestCompletionResponseRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'QuestNumber' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'QuestGroup' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestGroup' exceeds packet boundary");
|
|
|
|
// Validate field 'IsQuestCompleted' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'IsQuestCompleted' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for QuestCancelled.
|
|
/// </summary>
|
|
[Test]
|
|
public void QuestCancelled_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 8;
|
|
var actualLength = QuestCancelledRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'QuestNumber' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'QuestGroup' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestGroup' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for QuestStateList.
|
|
/// </summary>
|
|
[Test]
|
|
public void QuestStateList_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'QuestCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'QuestCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for QuestState.
|
|
/// </summary>
|
|
[Test]
|
|
public void QuestState_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 251;
|
|
var actualLength = QuestStateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'QuestNumber' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'QuestGroup' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestGroup' exceeds packet boundary");
|
|
|
|
// Validate field 'ConditionCount' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ConditionCount' exceeds packet boundary");
|
|
|
|
// Validate field 'RewardCount' boundary
|
|
Assert.That(9 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RewardCount' exceeds packet boundary");
|
|
|
|
// Validate field 'RandomRewardCount' boundary
|
|
Assert.That(10 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RandomRewardCount' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for QuestStateExtended.
|
|
/// </summary>
|
|
[Test]
|
|
public void QuestStateExtended_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 272;
|
|
var actualLength = QuestStateExtendedRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'ConditionCount' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ConditionCount' exceeds packet boundary");
|
|
|
|
// Validate field 'RewardCount' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RewardCount' exceeds packet boundary");
|
|
|
|
// Validate field 'RandomRewardCount' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RandomRewardCount' exceeds packet boundary");
|
|
|
|
// Validate field 'QuestNumber' boundary
|
|
Assert.That(8 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'QuestGroup' boundary
|
|
Assert.That(10 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'QuestGroup' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for OpenNpcDialog.
|
|
/// </summary>
|
|
[Test]
|
|
public void OpenNpcDialog_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 12;
|
|
var actualLength = OpenNpcDialogRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'NpcNumber' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'NpcNumber' exceeds packet boundary");
|
|
|
|
// Validate field 'GensContributionPoints' boundary
|
|
Assert.That(8 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'GensContributionPoints' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for DevilSquareEnterResult.
|
|
/// </summary>
|
|
[Test]
|
|
public void DevilSquareEnterResult_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = DevilSquareEnterResultRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MiniGameOpeningState.
|
|
/// </summary>
|
|
[Test]
|
|
public void MiniGameOpeningState_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 7;
|
|
var actualLength = MiniGameOpeningStateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'GameType' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'GameType' exceeds packet boundary");
|
|
|
|
// Validate field 'RemainingEnteringTimeMinutes' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RemainingEnteringTimeMinutes' exceeds packet boundary");
|
|
|
|
// Validate field 'UserCount' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'UserCount' exceeds packet boundary");
|
|
|
|
// Validate field 'RemainingEnteringTimeMinutesLow' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RemainingEnteringTimeMinutesLow' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for UpdateMiniGameState.
|
|
/// </summary>
|
|
[Test]
|
|
public void UpdateMiniGameState_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = UpdateMiniGameStateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'State' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'State' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MiniGameScoreTable.
|
|
/// </summary>
|
|
[Test]
|
|
public void MiniGameScoreTable_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'PlayerRank' starts at index 3 with size 1
|
|
Assert.That(3, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'PlayerRank' has invalid negative index");
|
|
|
|
// Field 'ResultCount' starts at index 4 with size 1
|
|
Assert.That(4, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'ResultCount' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for BloodCastleScore.
|
|
/// </summary>
|
|
[Test]
|
|
public void BloodCastleScore_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 29;
|
|
var actualLength = BloodCastleScoreRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Success' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Success' exceeds packet boundary");
|
|
|
|
// Validate field 'Type' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Type' exceeds packet boundary");
|
|
|
|
// Validate field 'PlayerName' boundary
|
|
Assert.That(5 + 10, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'PlayerName' exceeds packet boundary");
|
|
|
|
// Validate field 'TotalScore' boundary
|
|
Assert.That(17 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'TotalScore' exceeds packet boundary");
|
|
|
|
// Validate field 'BonusExperience' boundary
|
|
Assert.That(21 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'BonusExperience' exceeds packet boundary");
|
|
|
|
// Validate field 'BonusMoney' boundary
|
|
Assert.That(25 + 4, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'BonusMoney' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for BloodCastleEnterResult.
|
|
/// </summary>
|
|
[Test]
|
|
public void BloodCastleEnterResult_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 4;
|
|
var actualLength = BloodCastleEnterResultRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for BloodCastleState.
|
|
/// </summary>
|
|
[Test]
|
|
public void BloodCastleState_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 13;
|
|
var actualLength = BloodCastleStateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'State' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'State' exceeds packet boundary");
|
|
|
|
// Validate field 'RemainSecond' boundary
|
|
Assert.That(4 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RemainSecond' exceeds packet boundary");
|
|
|
|
// Validate field 'MaxMonster' boundary
|
|
Assert.That(6 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MaxMonster' exceeds packet boundary");
|
|
|
|
// Validate field 'CurMonster' boundary
|
|
Assert.That(8 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'CurMonster' exceeds packet boundary");
|
|
|
|
// Validate field 'ItemOwnerId' boundary
|
|
Assert.That(10 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ItemOwnerId' exceeds packet boundary");
|
|
|
|
// Validate field 'ItemLevel' boundary
|
|
Assert.That(12 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'ItemLevel' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for ChaosCastleEnterResult.
|
|
/// </summary>
|
|
[Test]
|
|
public void ChaosCastleEnterResult_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = ChaosCastleEnterResultRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Result' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Result' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for MapEventState.
|
|
/// </summary>
|
|
[Test]
|
|
public void MapEventState_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = MapEventStateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Enable' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Enable' exceeds packet boundary");
|
|
|
|
// Validate field 'Event' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Event' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for HeykelSavasiOpenTeamPanel.
|
|
/// </summary>
|
|
[Test]
|
|
public void HeykelSavasiOpenTeamPanel_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 5;
|
|
var actualLength = HeykelSavasiOpenTeamPanelRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'RedCount' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RedCount' exceeds packet boundary");
|
|
|
|
// Validate field 'BlueCount' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'BlueCount' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for HeykelSavasiHudState.
|
|
/// </summary>
|
|
[Test]
|
|
public void HeykelSavasiHudState_PacketSizeValidation()
|
|
{
|
|
// Fixed-length packet validation
|
|
const int expectedLength = 11;
|
|
var actualLength = HeykelSavasiHudStateRef.Length;
|
|
|
|
Assert.That(actualLength, Is.EqualTo(expectedLength),
|
|
"Packet length mismatch: declared length does not match calculated size");
|
|
|
|
// Validate field 'Phase' boundary
|
|
Assert.That(3 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'Phase' exceeds packet boundary");
|
|
|
|
// Validate field 'MyTeam' boundary
|
|
Assert.That(4 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'MyTeam' exceeds packet boundary");
|
|
|
|
// Validate field 'RedCount' boundary
|
|
Assert.That(5 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RedCount' exceeds packet boundary");
|
|
|
|
// Validate field 'BlueCount' boundary
|
|
Assert.That(6 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'BlueCount' exceeds packet boundary");
|
|
|
|
// Validate field 'RedProgress' boundary
|
|
Assert.That(7 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RedProgress' exceeds packet boundary");
|
|
|
|
// Validate field 'BlueProgress' boundary
|
|
Assert.That(8 + 1, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'BlueProgress' exceeds packet boundary");
|
|
|
|
// Validate field 'RemainingSeconds' boundary
|
|
Assert.That(9 + 2, Is.LessThanOrEqualTo(expectedLength),
|
|
"Field 'RemainingSeconds' exceeds packet boundary");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for HeykelSavasiTeamRoster.
|
|
/// </summary>
|
|
[Test]
|
|
public void HeykelSavasiTeamRoster_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'Count' starts at index 3 with size 1
|
|
Assert.That(3, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Count' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for HeykelSavasiScoreboard.
|
|
/// </summary>
|
|
[Test]
|
|
public void HeykelSavasiScoreboard_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'Count' starts at index 3 with size 1
|
|
Assert.That(3, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Count' has invalid negative index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tests the packet size calculation for AvailableChatCommand.
|
|
/// </summary>
|
|
[Test]
|
|
public void AvailableChatCommand_PacketSizeValidation()
|
|
{
|
|
// Basic packet validation
|
|
// Validate header type and field boundaries
|
|
|
|
// Field 'Index' starts at index 5 with size 1
|
|
Assert.That(5, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Index' has invalid negative index");
|
|
|
|
// Field 'Count' starts at index 6 with size 1
|
|
Assert.That(6, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Count' has invalid negative index");
|
|
|
|
// Field 'MinimumCharacterStatus' starts at index 7 with size 1
|
|
Assert.That(7, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'MinimumCharacterStatus' has invalid negative index");
|
|
|
|
// Field 'ParameterCount' starts at index 8 with size 1
|
|
Assert.That(8, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'ParameterCount' has invalid negative index");
|
|
|
|
// Field 'Command' starts at index 9 with size 32
|
|
Assert.That(9, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Command' has invalid negative index");
|
|
|
|
// Field 'Name' starts at index 41 with size 48
|
|
Assert.That(41, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Name' has invalid negative index");
|
|
|
|
// Field 'Description' starts at index 89 with size 256
|
|
Assert.That(89, Is.GreaterThanOrEqualTo(0),
|
|
"Field 'Description' has invalid negative index");
|
|
}
|
|
}
|