//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.Tests;
using Moq;
using MUnique.OpenMU.DataModel.Configuration;
using MUnique.OpenMU.DataModel.Configuration.Items;
using MUnique.OpenMU.DataModel.Entities;
using MUnique.OpenMU.GameServer.RemoteView;
///
/// Tests the .
///
[TestFixture]
public class AppearanceSerializerTest
{
///
/// Tests if a new (naked) dark knight with small axe would be serialized correctly.
///
[Test]
public void NewDarkKnightWithSmallAxe()
{
var serializer = new AppearanceSerializer();
var appearanceData = new Mock();
appearanceData.Setup(a => a.CharacterClass).Returns(new CharacterClass { Number = 0x20 >> 3 }); // Dark Knight;
appearanceData.Setup(a => a.EquippedItems).Returns(this.GetSmallAxeEquipped());
var data = new byte[serializer.NeededSpace];
serializer.WriteAppearanceData(data, appearanceData.Object, false);
var expected = new byte[] { 0x20, 0x00, 0xFF, 0xFF, 0xFF, 0xF3, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x20, 0xFF, 0xFF, 0xFF, 0x00, 0x00 };
Assert.That(data, Is.EquivalentTo(expected));
}
private IEnumerable GetSmallAxeEquipped()
{
yield return new ItemAppearance { Definition = new ItemDefinition { Group = 1 } };
}
}